Re: Newbie Question

From: Date: Wed, 25 Apr 2001 18:36:06 +0000
Subject: Re: Newbie Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-50332@lists.php.net to get a copy of this message
In article <9c1gqf$i3j$1@toye.p.sourceforge.net>, "Wade" <wwilliams@myoptionvalue.com> wrote: well, in your first IF clause, you refer to my_type without the $. For the else clause, you are outputting HTML while still inside the PHP block. try one of these: } 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 } or } else { print<<<EOF <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> EOF; } hope that helps, Jeff > 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 (#50332) next »