Solved

Help to add a condition that executes onClick

Posted on 2010-11-23
2
260 Views
Last Modified: 2012-05-10

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
Comment
Question by:a0k0a7
2 Comments
 
LVL 16

Accepted Solution

by:
Chris Harte earned 500 total points
ID: 34196107
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
 
LVL 8

Author Closing Comment

by:a0k0a7
ID: 34203285
Thank You!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
form button worked now it doesnt anymore 9 40
mysql update statement effect only some rows 4 26
php string masking 4 27
hiding/removing php extension - best practice 4 24
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now