I can't seem to find a workaround for this.
I have a smarty based script that im using.
I am trying somehow submit 2 values from a form that is on my submit post page. I am actually successfully posting several fields into the "posts" table already from my current form.
However, here's where my problem is, I need to get both the category name and the category id into to their own columns. Right now I can only choose one or the other.
My form contains this :
<select name="category" id="category" >
{section name=i loop=$msgcat}
<option value="{$msgcat[i].catname|stripslashes}">{$msgcat[i].catname|stripslashes}</option>
{/section}
</select>
Which will render this in html as :
<select id="category" name="category">
<option value="Car">Car</option>
<option value="Truck">Truck</option>
<option value="Boat">Boat</option>
<option value="Motorcycle">Motorcycle</option>
<option value="RV">RV</option>
<option value="Other">Other</option>
</select>
Is there a way in this same form I can have a hidden input field called catid which could assign the associated category id "value" based on which "category" drop down selection is made?
Something like "if category selection = Car, then hidden input value = 1" (would have to include a rule for each dropdown selection)
Would this be done in php? javascript?
Is there a much better way to do what im trying to do?
Right now the "category" drop down field gets submitted properly to the "posts" table into the "category" column. Respectively, I need the catid to go into the "catid" column in the same table.
The catid is a defined value for each category, e.g. Car=1, Truck=2, Boat=3...
Where 1 is the catid for "Car" ...and so on.