Jump to content

[SOLVED] Submitting with 2 buttons while using all inputs on form


Recommended Posts

Can anyone advise how I can have a form, with 2 submit buttons that pass a different parameter that I can use?  In otherwords, I want one button that I can act on a "preview" and one that can act on a "upload".   I don't know how to tell in my "post" logic which button was hit.

 

Each function requires all of the "post" values (inputs) of the form.  I could use two fake buttons as images and a url, but I would have to have all the parms on the url link, wouldn't I?

 

Thanks in advance.

Jeff

<?php

if ($_POST['submit1']) {
	echo "You hit Submit 1";
}
if ($_POST['submit2']) {
echo "You hit Submit 2";
}

?>
<form method="POST">
<input type='submit' name="submit1" value="Submit 1">
<input type='submit' name="submit2" value="Submit 2">
</form>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.