Forums
This topic is locked
php form handler
Posted 21 May 2006 21:27:26
1
has voted
21 May 2006 21:27:26 simon wantling posted:
Please help. I have a nature website which uses mysql database to store images etc. On my search page users can enter a search string which retrieves it from the database and displays the results as text. Would I would like to do is add a check box so that users can select this if they want to view results by thumbnails. What I am trying to code is an alternative page load when the check box is checked and I'm having real problems and getting lost. Here is a snippet of the code which I think is the crucial part. I hope someone can help me mad !! It doesn't seem to recognise that the checkbox is checked.<?
if ($_POST['checkbox']>0)
{
$action = "databaseintroresultsthumb.php";
}
else
{
$action = "databaseintroresults.php";
}
?>
<form action = "<?php echo $action; ?>" method="get" name="indexform" id="indexform">
Thanks
Simon
Replies
Replied 22 May 2006 16:10:48
22 May 2006 16:10:48 Roddy Dairion replied:
I don't know but what you're trying to do but you can try this out
<pre id=code><font face=courier size=2 id=code>
if ($_POST['your button name'] == "Your button value"
{
if (isset($_POST['checkbox']))
{
header ("location: databaseintroresultsthumb.php"
}
else
{
header ("location: databaseintroresults.php"
}
}
</font id=code></pre id=code>
Some other parameters might be needed wiv it but. I don't kno them so will need to try and modify it.
<pre id=code><font face=courier size=2 id=code>
if ($_POST['your button name'] == "Your button value"
{
if (isset($_POST['checkbox']))
{
header ("location: databaseintroresultsthumb.php"
}
else
{
header ("location: databaseintroresults.php"
}
}
</font id=code></pre id=code>
Some other parameters might be needed wiv it but. I don't kno them so will need to try and modify it.