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:[EMAIL PROTECTED]]
Sent: 23 April 2001 16:15
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]