Newbie Question

From: Date: Mon, 23 Apr 2001 15:15:20 +0000
Subject: Newbie Question
Groups: php.general 
Request: Send a blank email to php-general+get-49864@lists.php.net to get a copy of this message
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> } }

« previous php.general (#49864) next »