PHP array, html options!
Posted: Wed Oct 05, 2005 5:00 pm
Hi,
I have a form that has a <Select> and options which are created from a database.
This is what it creates.
now when its submited to the other page I want it to set the "page_title" value not to the "value" of the option but the text inside the <options></options> tags.
I have trired creating an array in php at the same time that I populate the options and then adding
"this.page_title.value=" . $ptypearray[ . "this.type.value" . ]"
to the onsubmit bit but all I get is a php error which I know why!
There must be a way of doing this ?
Cheers
Andrew
P.s - Sorry if the post is a mess Im tired been working on this for a while!!!! lol
I have a form that has a <Select> and options which are created from a database.
This is what it creates.
Code: Select all
<form onSubmit="" name="product_list" action="index.php?xps=pindex.php">
<select name="type">
<option selected value="null">Select a Product Type</option>
<optgroup label=Cat1>
<option value=3>Cat1Sub1</option>
</optgroup>
<optgroup label=Cat2>
<option value=5>SubCat1</option>
<option value=5>SubCat2</option>
</optgroup>
</select>
<br>
<input type="hidden" name="xps" value="pindex">
<input type="hidden" name="page_title" value="">
<input value="GO" type="submit" type="submit">
</form>I have trired creating an array in php at the same time that I populate the options and then adding
"this.page_title.value=" . $ptypearray[ . "this.type.value" . ]"
to the onsubmit bit but all I get is a php error which I know why!
There must be a way of doing this ?
Cheers
Andrew
P.s - Sorry if the post is a mess Im tired been working on this for a while!!!! lol