Jump to content

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


jeffjohnvol

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.