Solved

Help to add a condition that executes onClick

Posted on 2010-11-23
2
261 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 17

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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

809 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