Forum Moderators: coopster
here is the HTML page:
<td style="border: 1pt dotted #000000"><select name="country">
<option>select your country
<OPTION VALUE="U.S.">U.S. </option>
<OPTION VALUE="Mexico">Mexico </option>
<OPTION VALUE="Canada">Canada </option>
<OPTION VALUE="Japan"> Japan </option>
</select></td>
</tr>
here is the php
#!/usr/local/bin/php --
<?php
//file feedback.php
echo "<BR>Name = $name";
echo "<BR>Gender = $gender";
echo "<BR>Address = $address";
echo "<BR>City = $city";
echo "<BR>State = $state";
echo "<BR>Zip = $zip";
echo "<BR>Country = $country";
echo "<BR>Phone = $phone";
echo "<BR>Email = $email";
echo"<BR>Comments = $comment";
echo "<BR>IP Address = $REMOTE_ADDR";
echo "<BR>title = $title";
?>
Appreciate any help.
Are you getting any of the other variables to dipslay on your php document - $name, $gender,$address, etc.?
foreach ($country as $key => $val)
echo "<br>$key $val";
}
If you are displaying all of the countries then the form SELECT statement would be my next area of focus. There, you could try something like
<form method="post" action="feedback.php" name="feedbackform" SIZE="1">, making sure that only a single item is selected from the options.
How did you know it would work?You told me, when you said you were receiving Array in the output.
Here's what I think it means - somewhere you are defining $country as an array. I think you didn't intend to, since you are just trying to pass the variable to a script and display the selection.
Arrays are defined in one of two ways, either with the array construct or by using square-bracket syntax.
$country = array();
or
$country[] = 'Selected Country';
If you are using the brackets (that's my guess), the array will be created if it doesn't exist. You might want to have another look at your form page and see how $country is being populated before it gets posted.
As an aside, you can view the content of $country, or any array, with the print_r function:
print_r($country);
And the output for $country will probably look like this:
Array
( [0] => Selected Country )