two buttons

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
r_amin
Forum Newbie
Posts: 3
Joined: Fri May 11, 2007 11:31 am

two buttons

Post by r_amin »

I want to use 2 button in my PHP Form File (there are 10 fields)
button1 = Submit
button2 = preview

How can i check which button selected?

(some javascript will be OK)


-----------------------------------------------
My main script something like

Code: Select all

incude header.php 
      if preview button selected    {  display informations }
      elseif submit button selected { include submit.php  -  exit } 
myForm is hare
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

Code: Select all

<input type="submit" name="btn_preview" value="Preview">
<input type="submit" name="btn_submit" value="Submit">

Code: Select all

if (isset($_REQUEST['btn_preview'])) ....
Post Reply