Jump to content

One Form, Two Submissions


justlukeyou

Recommended Posts

Lets say a website is dedicated to two different people (Bob and Richard).  The site has a contact page in which people can email the two people. 

 

Is it possible to create a form in which someone can enter a message but there are two submission options.  So in this example there are two images.  One reads "Send Email to Bob" and the other reads "Send Email to Richard".

 

Is it possible to do this or to have two submission methods from one form?

Link to comment
https://forums.phpfreaks.com/topic/235208-one-form-two-submissions/
Share on other sites

Yes a form can have multiple submit buttons.

<?php

if(isset($_POST['bob_submit']))
{
     echo "send message to bob";
}
elseif(isset($_POST['richard_submit']))
{
     echo "send message to richard";
}

?>

<form action="" method="post">

<input type="submit" name="bob_submit" value="Send to Bob" /> Or <input type="submit" name="richard_submit" value="Send to Richard" />
</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.