PDA

View Full Version : forms....


c q
09-14-2002, 06:26 PM
Forms

simple html forms question this....
What I'm tryiing to create is a wordlist with synonyms and antonyms; all entered by the user. Here's some code I made...


<form action=word.php?target=add method=POST>
<input type=text name=word>
<textarea name=meaning>
<br><br>

<!---here's the problem code----->
<input type=text name=antonym>
<input type=submit value=add>
<SELECT NAME=antonymslist MULTIPLE>
<OPTION value=antonymslist[1]>sddf </OPTION>
<OPTION value=antonymslist[2]>asaf </OPTION>
<OPTION value=antonymsliist[3]>sddfa </OPTION>
</SELECT>


<input type=text name=synonym>
<input type=submit value=add>
<SELECT NAME=synonymslist MULTIPLE>
<OPTION value=synonymslist[1]>sddf </OPTION>
<OPTION value=synonymslist[2]>asaf </OPTION>
<OPTION value=synonymsliist[3]>sddfa </OPTION>
</SELECT>
<!-----end of problem code lol ---->
<br>
<input type="submit" value=submit>
</form>


the approach is probably that each time the user enters an antonym in the text field "antonym" and hits the "add" button, that antonym is added to an array the elements of which are shown in the "antonymslist" field.
and finally when the form is submitted, all that gets submitted is the elements from "word" "meaning" and the arrays "synonymslist" and "antonymslist", that with the final submit button. what do I do about this ???????

c q
09-18-2002, 03:50 PM
no reply :(

Roy Sinclair
09-18-2002, 05:17 PM
You need to add a hidden form field and when the form is submitted, roll through the array concatenating all the words into a string (with delimiters) and put that string into the value of the hidden field. With select lists you only get the selected item(s), not the whole list.

ddubs
09-19-2002, 05:27 AM
don't for get about form validation!!;)