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
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>

Link to comment
Share on other sites

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.