Jump to content

Need help with passing form variables


Recommended Posts

Hi I am trying to create a contact form where a user can select an option in a combo box then pass it to a php script then it will send out the information in the form to a diffrent email address according to what is selected.  I can not get it to work.  Here is my code

HTML Form Code:

<form name="form1" method="post" action="process.php">
  <label>What are you contacting us concerning
  <select name="type" id="type">
    <option value="general" selected>General Information</option>
    <option value="jesse">Contact Pastor Jesse</option>
    <option value="prayer">Prayer Request</option>
    <option value="victory">Victory Report</option>
    <option value="enlist">Enlistment Information</option>
    <option value="dexter">Dexter Lake Church of God</option>
    <option value="web">Dexter Lake Web Team</option>
    </select>
  <br>
  <br>
  Name
    <input name="name" type="text" id="name">
    <br>
    E-Mail
    <input name="email" type="text" id="email">
    <br>
    Prayer Request*
    <textarea name="prayerRequest" id="prayerRequest"></textarea>
    <br>
    <br>
    *= Required <br>
    </label>
  <label></label>
  <input type="submit" name="Submit" value="Submit">
</form>

Process.php code:
<?php
$type = $_GET('type');
$name = $_GET("name");
$email = $_GET('email');
$prayerrequest = $_GET('prayerRequest');
if ( $type == "General Information")
{
$sendemail = "moviejunkie@gmail.com";
$subject = "Requesting General Information from the HeirForce Web Site";
}
if ( $type == "Prayer Request")
{
$sendmail = "moviejunkie@gmail.com";
$subject = "Prayer Request from HeirForce Web Site";
}
mail($sendmail, $subject ,"From: $name <$email> -- $prayerRequest");
?>
<script language="JavaScript" type="text/JavaScript">
<!--
window.location.href = "http://www.yourdomain.net/yourpage.html";
//-->
</script>

(Also if there another way to redirect after the process that would be awsome)

Thank you so much for your help.
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.