GetDotted Domains

Viewing Thread:
"PHP: Form submission problem

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Thu 08/11/07 at 21:51
Regular
"LFXX98763X"
Posts: 7
Hello,

I'm having a problem with the following code.
The current code works great, when an option is chosen from the 'referrer' drop down list it is returned selected if any other fields are blank. (I have if statements handling whether any fields are blank i.e. 'name' when the form is submitted)


<?php
$sel_referrer .= "
<option value=\"\"></option>";

$get_referrers = mysql_query("SELECT * FROM advertisers WHERE hide = '1'");
$i = 0;
$total_referrers = mysql_num_rows($get_referrers);

while($i < $total_referrers) {
$selected = ($_POST['referrer'] == mysql_result($get_referrers,$i,"id"))?" selected":"";
$sel_referrer .= "
<option value=\" ".mysql_result($get_referrers,$i,"id")."\" $selected> ".stripslashes(mysql_result($get_referrers,$i," advertiser"))." </option>";
$i++;
}
?>



<form action="index.php" method="post">
<input type="text" name="name" value="<? $_POST[name] ?>">
<select name="referrer"><? echo $sel_referrer ?></select>
<input type="submit" name="Submit" value="Submit Enquiry">
</form>


However, when changing the to a 'multiple' listing (shown below), the form is not returning mutliple selected options from the list, just one option that is selected.
I've tried a few different changes to the php code above but nothing seems to be working.


<form action="index.php" method="post">
<input type="text" name="name" value="<? $_POST[name] ?>">
<select name="referrer" [B]multiple[/B]><? echo $sel_referrer ?></select>
<input type="submit" name="Submit" value="Submit Enquiry">
</form>


Any ideas would be greatly appreciated.

Regards

Drazen

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

10/10
Over the years I've become very jaded after many bad experiences with customer services, you have bucked the trend. Polite and efficient from the Freeola team, well done to all involved.
I am delighted.
Brilliant! As usual the careful and intuitive production that Freeola puts into everything it sets out to do. I am delighted.

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.