0

I have dropdown on Enquiry page, some text boxes etc with a capthca below and submit button

I used this code for my text boxes

<input name="fld_name" type="text" id="fld_name" size="40" value="<?php if($_POST['fld_name']) { echo $_POST['fld_name']; } ?>" />

it keeps the data in the textboxes when the user does something worng like type in wrong captcha code.

The drop down boxes however dont wokr with that code lol, my code looks like this

<select name = "fld_wherehear" id="fld_wherehear" >
					  <option value = "0" selected>Select...</option>
	<option value = "1">Internet</option>
	<option value = "2">Newsletter</option>
	<option value = "3">Friend</option>
	<option value = "4">Magazine</option>
	<option value = "5">Other</option>
</select>
3
Contributors
3
Replies
9
Views
6 Years
Discussion Span
Last Post by branding4you
0
<select name = "fld_wherehear" id="fld_wherehear" >
					  <option value = "0" >Select...</option>
	<option value = "1" <?php echo (($_POST["fld_wherehear"]==1)?"selected":"") ;?> >Internet</option>
	<option value = "2" <?php echo (($_POST["fld_wherehear"]==2)?"selected":"") ;?>>Newsletter</option>
	<option value = "3" <?php echo (($_POST["fld_wherehear"]==3)?"selected":"") ;?>>Friend</option>
	<option value = "4" <?php echo (($_POST["fld_wherehear"]==4)?"selected":"") ;?>>Magazine</option>
	<option value = "5" <?php echo (($_POST["fld_wherehear"]==5)?"selected":"") ;?>>Other</option>
</select>

Edited by urtrivedi: n/a

0

Its using if statement

<select name = "fld_wherehear" id="fld_wherehear" >
    <option value = "0" >Select...</option>
    <option value = "1" <?php if($_POST["fld_wherehear"]=="1") echo "selected"; ?> >Internet</option>
    <option value = "2" <?php if($_POST["fld_wherehear"]=="2") echo "selected"; ?> >Newsletter</option>
    <option value = "3" <?php if($_POST["fld_wherehear"]=="3") echo "selected"; ?> >Friend</option>
    <option value = "4" <?php if($_POST["fld_wherehear"]=="4") echo "selected"; ?> >Magazine</option>
    <option value = "5" <?php if($_POST["fld_wherehear"]=="5") echo "selected"; ?> >Other</option>
    </select>

Edited by karthik_ppts: n/a

0

and i was trying this code ... lol

<select name = "fld_wherehear" id="fld_wherehear" value="<?php if($_POST['fld_name']) { echo $_POST['fld_name']; } ?>">
					  <option value = "0" selected>Select...</option>
					  <option value = "1">Internet</option>
					  <option value = "2">Newsletter</option>
					  <option value = "3">Friend</option>
					  <option value = "4">Magazine</option>
					  <option value = "5">Other</option>
				    </select>

feel real dumb now, but im learning allot ...

THANKS You guys rock !!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.