RE: [PHP] Newbie Question

From: Date: Mon, 23 Apr 2001 15:34:37 +0000
Subject: RE: [PHP] Newbie Question
Groups: php.general 
Request: Send a blank email to php-general+get-49870@lists.php.net to get a copy of this message
You've got some typo's if (my_type != "0"){ --> if ($my_type != "0") { Plus you forgot to use the print function (or to turn off php ?>) to output the Select HTML. -Stewart -----Original Message----- From: Wade [mailto:wwilliams@myoptionvalue.com] Sent: 23 April 2001 16:15 To: php-general@lists.php.net Subject: [PHP] Newbie Question I wanted to say thanks to all those that have helped me. This is really a great language and I am doing things I never thought I'd be able to do! Now to my question: I am doing some form validation, where I check the values entered by the user. If the value is correct, I format the results and print it out. If it is not correct, I want to allow them to fix it. When I have a text field, like first_name, I'm ok. But when I do an HTML list menu, I'm having troubles. Basically, this is what I want to do. If the value is correct, print the value. If it is not correct, display the list box. Here's an example (but you can see my else statement is wrong, and this is what I need help with): if (my_type != "0"){ switch($my_type){ case "one": print "<img src=\"/trillion/img/one.gif\" width=\"41\" height=\"26\" alt=\"One\">"; print " One"; break; case "two": print "<img src=\"/trillion/img/two.gif\" width=\"41\" height=\"26\" alt=\"Two\">"; print " Two"; break; case "three": print "<img src=\"/trillion/img/three.gif\" width=\"40\" height=\"26\" alt=\"Three\">"; print " Three"; break; } } else { <select tabindex=13 name="my_type"> <option value="0" selected>Select a Value</option> <option value="one">One</option> <option value="two">Two</option> <option value="three">Three</option> </select> } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#49870) next »