Jump to content

[SOLVED] Multiple forms on page - submit button question


Kane250

Recommended Posts

Yes

 

<form action="form.php">
Something: <input type="text" name="Something">
<input type="submit" name="submit" value="Something">
</form>
<form action="form.php">
Something: <input type="text" name="SomethingElse">
<input type="submit" name="submit" value="SomethingElse">
</form>

 

and then...

<?php
$submit = $_POST["submit"];
if($submit == "Something"){
// do something for form 1
} elseif($submit == "SomethingElse"){
// do soemthing for form 2
} else {
echo "ERROR. YOU DIVIDED BY ZERO.";
}
?>

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.