Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

Help to add a condition that executes onClick


On the line of code below I have a Yes and No button;

$error = "<center>Welcome, Do you want to redeem this voucher <br><input type=submit value=yes />&nbsp;&nbsp;<input type=submit value='no' /></center>";

This information later displayed by this line:

<?
if($error){ ?><div style=" background:#FFFFCC; padding:5px; border:solid #FF0000 1px;"><?=$error?></div><? }
?>

I would like to execute an insert into the database if the user press yes, if the user press no I want to send the user to specific URL, how I do that, any ideas or advice is appreciated.
0
a0k0a7
Asked:
a0k0a7
1 Solution
 
Chris HarteThaumaturgeCommented:
At the moment those buttons are on the page but they are not doing anything. You need an action to go with them, and that has to be inside a form.
<center>Welcome, Do you want to redeem this voucher <br>
</center>
        <form action="insert.php" method="post">
        	<input type="submit" value="yes" name="yes" />
        </form>
        <form action="http://url" method="post">
        	<input type="submit" value="no" name="no" />
        </form>

Open in new window

0
 
a0k0a7Author Commented:
Thank You!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now