Jump to content

PHP Email Form question -


autodefrost

Recommended Posts

I'm new to this, and have figured out how to do a few things, but now stuck.

 

I have a from, everything works fine - but I'm trying to add checkbox, and have run into problems.

 

I'm not sure how to define it in the PHP (adding it in the HTML is fine, but when I add the information in th PHP, I get errors)

 

This is one of the things that I've tried:

 

$Response= $_POST['Response'] ;

 

"Response: $Response\n" .

 

 

<?

----

 

$mailto = 'info@myemail.com' ;

 

 

$subject = "Website Form" ;

$formurl = "http://www.summerfestwindsor.org/main/index.html" ;

$errorurl = "http://www.summerfestwindsor.org/main/" ;

$thankyouurl = "http://www.summerfestwindsor.org/main/volunteer-thankyou.html" ;

 

$uself = 1;

 

// --------------------

 

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;

$name = $_POST['name'] ;

$email = $_POST['email'] ;

$phoneH = $_POST['phoneH'] ;

$phoneW = $_POST['phoneW'] ;

$address = $_POST['address'] ;

$city = $_POST['city'] ;

$province = $_POST['province'] ;

$comments = $_POST['comments'] ;

$eventnumber = $_POST['eventnumber'] ;

$attend = $_POST['attend'] ;

$http_referrer = getenv( "HTTP_REFERER" );

 

if (!isset($_POST['email'])) {

header( "Location: $formurl" );

exit ;

}

if (empty($name) || empty($email) || empty($comments)) {

  header( "Location: $errorurl" );

  exit ;

}

if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {

header( "Location: $errorurl" );

exit ;

}

 

if (get_magic_quotes_gpc()) {

$comments = stripslashes( $comments );

}

 

$messageproper =

 

"This message was sent from:\n" .

"$http_referrer\n" .

"------------------------------------------------------------\n" .

"Name of sender: $name\n" .

"Email of sender: $email\n" .

"Home phone of sender: $phoneH\n" .

"Work phone of sender: $phoneW\n" .

"Address of sender: $address\n" .

"City of sender: $city\n" .

"Province of sender: $province\n" .

"eventnumber: $eventnumber\n" .

"attend: $attend\n" .

 

"------------------------- COMMENTS -------------------------\n\n" .

$comments .

"\n\n------------------------------------------------------------\n" ;

 

 

mail($mailto, $subject, $messageproper,

"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );

header( "Location: $thankyouurl" );

exit ;

 

?>

 

 

 

 

 

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

 

<title>xxxx</title>

</head>

 

<body>

<table align="center" width="85%">

  <tr></tr>

  <tr>

    <td align="left">

      <form action="feedback.php" method="post">

        <table width="100%" border="0" cellpadding="5" cellspacing="2" summary="feedback form">

          <tr>

            <td>Name:</td>

            <td><input type="text" name="name" size="25" /></td>

          </tr>

          <tr>

            <td>Email address:</td>

            <td><input type="text" name="email" size="25" /></td>

          </tr>

          <tr>

            <td>Phone (Work):</td>

            <td><input name="phoneW" type="text" id="phoneW" size="25" /></td>

          </tr>

          <tr>

            <td>Address:</td>

            <td><input name="address" type="text" id="address" size="25" /></td>

          </tr>

          <tr>

            <td>City:</td>

            <td><input name="city" type="text" id="city" size="25" /></td>

          </tr>

          <tr>

            <td>Province:</td>

            <td><input name="province" type="text" id="province" size="25" /></td>

          </tr>

          <tr>

            <td colspan="2">Comments:</td>

          </tr>

          <tr>

            <td colspan="2" align="center" valign="top"><textarea rows="15" cols="50" name="comments"></textarea></td>

          </tr>

          <tr>

            <td align="right"><label>

              <input name="Response" type="checkbox" id="Response" value="emailres" />

            </label></td>

            <td align="left">Email response requested </td>

          </tr>

          <tr>

            <td align="right"><label>

              <input name="ResponseT" type="checkbox" id="ResponseT" value="teleres" />

            </label></td>

            <td align="left"> Telephone response requested</td>

          </tr>

          <tr>

            <td align="center" colspan="2"> </td>

          </tr>

          <tr>

            <td align="center" colspan="2"> </td>

          </tr>

          <tr>

            <td align="left">Event Number: </td>

            <td align="left"><label>

              <input name="eventnumber" type="text" id="eventnumber" size="25" />

            </label></td>

          </tr>

          <tr>

            <td align="center">Number of Attendees: </td>

            <td align="left"><input name="attend" type="text" id="attend" size="25" /></td>

          </tr>

          <tr>

            <td align="center" colspan="2"> </td>

          </tr>

          <tr>

            <td align="center" colspan="2"> </td>

          </tr>

          <tr>

            <td align="center" colspan="2"><input name="submit" type="submit" value="Send Feedback" /></td>

          </tr>

        </table>

      </form>

    </div></td>

  </tr>

</table>

</body>

</html>

 

 

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.