Forum Moderators: coopster
echo "<input name=\"Submit\" type=\"submit\"
but then I get this submit button up, and need first to submit the drop down value to the variable before using my 'submit.gif' button I use in the php code. The only thing I want is to set the choosen drop down variable to the ($color_name) variable later to be used in the php code.
Hope you can help, Im insanelly stuck on this!
The code logic is as follows:
....
html code
....
<?php
$color1="beige";
$color2="blue";
$color3="pink";
echo "<td valign=\"top\"><form name=\"form1\"method=\"post\">";
echo"<select name='color_name' class='boxes'>";
echo"<option value=\"$color1\">$color1</option>";
echo"<option value=\"$color2\">$color2</option>";
echo"<option value=\"$color3\">$color3</option>";
echo"<input type=hidden name=hidden1 value=\"$color1\">";
echo"<input type=hidden name=hidden1 value=\"$color2\">";
echo"<input type=hidden name=hidden1 value=\"$color3\">";
echo "<input name=\"Submit\" type=\"submit\" class=\"submitbutton\" value=\"Submit\">";
echo"</select>";
echo "</form></td>";
?>
....
html code
....
php code start
....
echo "<a href=\"cart1.php action=add_item&id=$itemId&qty=1&colorid=$color_name\"><img src=\"http://www.****/submit.gif\" border=\"0\"></a>\n";
....
php code end
Here's another idea for your script that another member told me about last week. This has at least one unintuitive requirement, so be sure to read up on it at php.net
....
html code
....
<?php
$color1="beige";
$color2="blue";
$color3="pink";
echo <<<EOD
<td valign="top"><form name="form1" method="post">
<select name='color_name' class='boxes'>
<option value="$color1">$color1</option>
<option value="$color2">$color2</option>
<option value="$color3">$color3</option>
<input type="hidden" name="hidden1" value="$color1">
<input type="hidden" name="hidden1" value="$color2">
<input type="hidden" name="hidden1" value="$color3">
<input name="Submit" type="submit" class="submitbutton" value="Submit">
</select>
</form></td>
EOD;
?>
....
html code Everything between the first and second EOD will be echoed. You can use other expressions (I think this is basically a variable name) other than EOD. You don't have to escape your quotes or use the echo for each line. You do have to put the final "EOD" on a separate line with no whitespace in front of it. It can be used with PHP variables in it, and (I think) it can be used to create a string.
I might also add \n at the end of each line to get those lines to appear on separate lines in view source to help with debugging. I think that'd work....
By the way, you should put quotes around all of your attributes, as shown here. Some of them were missing on the hidden inputs.