New to PHP, keep that in mind.
My question:
I have a checkbox setup, however when someone clicks a checkbox it returns a '1' instead of the value. How do I fix this?
<td valign="top">Kies minimaal 1 tijdschrift:</td>
<td><input type="checkbox" name="gamez" value="gamez" />Stuur mij informatie over het tijdschrijft GAMEZ<br />
$gamez = (isset($_POST["gamez"]) ?
true : false);
echo("<tr><td>Tijdschriften:</td><td>$gamez $girls $uitgaan $mode</td></tr></table>");
When I check gamez for instance, it shows: Tijdschriften: 1
Of course. You are writing true
into it, which is cast to string "1" when you echo
it. Write the value in it:
$option1 = (isset($_POST["option1"]) ? $_POST["option1"] : false);
echo("<tr><td>Options:</td><td>$option1</td></tr></table>");
Note that when $_POST["option1"]
is not set, $option1
is false
, which when echo
'd is cast to an empty string.
if(isset($_POST["option1"]))
{
$option1=$_POST["option1"];
echo "<tr><td>Options:</td><td>$option1</td></tr></table>"; //echo not a function
}
else
{
}
its true.you are writting true
*if(isset($_post['option1'] )
{
$option1=$post["option1"];
echo("<tr><td>options:</td><td></tr></table>");
}*
note that when $_post["option1] is not set