Option pull-down value help (should be easy)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jr
Forum Commoner
Posts: 99
Joined: Mon Mar 07, 2005 3:25 pm

Option pull-down value help (should be easy)

Post by Jr »

Ok... I have an option pull-down that changes the maxlength of a text area onchange (that part works fine). I have the 'name' for the option as 'contact_name' so every time contact_name != "" it sends an email when form is submitted. My problem is that i am using the 'value' for the option to change the maxlength or the text area but I still need to print out a value depending on who they choose to send the email to can i print "$id" or something if i set an ID for each of the different options? This is what the <select><option> looks like before it gets sent to the IF statement that changes the maxlength.

Code: Select all

print &quote;<SELECT name='contact_name' ONCHANGE='location = this.options&#1111;this.selectedIndex].value;'>&quote;;
	print &quote;<option name='' VALUE='contact.php?switch_length=nothing' $select_nothing></option>&quote;;
	print &quote;<option name='Jéréme' VALUE='contact.php?switch_length=jereme_email' $select_jereme_email>Jéréme(eMail)</option>&quote;;
	print &quote;<option name='Jéréme(Cell)' VALUE='contact.php?switch_length=jereme_cell' $select_jereme_cell>Jéréme(Cell)</option>&quote;;
	print &quote;<option name='Jéréme' VALUE='contact.php?switch_length=webmaster' $select_webmaster>WebMaster</option>&quote;;
print &quote;</select>&quote;;
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

Jr wrote:but I still need to print out a value depending on who they choose to send the email to
Can you explain this further... :?
Post Reply