I am new to PHP so sorry if this has been covered before - couldn't find anything through a search.
I want to set up an array that I can use to fill a selection box in a form. My array looks like
$AdTypeArray = array(1=> 'Not known', 'Newspaper text only', 'Newspaper Column Colour', 'Newspaper Column BW', 'Web directory', 'Directory Column Colour',
'Search Engine', 'Website', 'Car', 'Recommendation', 'Shop');
and my form code is:
<td id='input'><select name='AdType'>";
for ($n=1;$n<=sizeof($AdTypeArray);$n++)
{
echo "<option value=$AdTypeArray[$n]";
if ($_POST['AdType'] == $AdTypeArray[$n])
{
echo " selected";
}
echo "> $AdTypeArray[$n]";
}
echo "</select></td>
On the form I get the full text from the array value but when the form is submitted $_POST[AdType] only holds the characters up to the first space. I have tried double quotes single quotes and combinations. Put double and single quotes around each value gives me the output I want from the form but the display on the form shows the value surrounded by the single quotes.
Any ideas please?
Robert