Solved

Help to add a condition that executes onClick

Posted on 2010-11-23
2
259 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
Comment Utility
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
Comment Utility
Thank You!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 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

6 Experts available now in Live!

Get 1:1 Help Now