TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-06-2008, 12:53 AM   #1 (permalink)
Super ModTastic
 
mike.fro's Avatar
 
Join Date: Apr 2005
Location: Apple Valley, MN
Posts: 89
Thanks: 1
mike.fro is on a distinguished road
Default Problem with mail [SOLVED]

Hello All,
Can someone explain to me what i'm doing wrong here:

PHP Code:
<?php
if(isset($_POST['submit'])) {
 

$to "contact@michaelfroseth.com";
$subject "Feedback Results";
$name_field $_POST['name'];
$email_field $_POST['email'];
$phone $_POST['phone'];
$message $_POST['message'];
$numPeople $_POST['numPeople'];
$numMen $_POST['men'];

foreach(
$_POST['select'] as $selected) {

$select_msg .= "Date: $selected\n";

}
 
foreach(
$_POST['check'] as $value) {

$check_msg .= "Checked: $value\n";


}
 
$body "From: $name_field\n E-Mail: $email_field\n Message:\n $message\n $check_msg\n Number of People:$numPeople\n Number of Men: $numMen\n $select_msg\n Phone: $phone";
 
echo 
"Data has been submitted to $to!";
mail($to$subject$body);
 

} else {

echo 
"blarg!";

}
?>
The HTML can be viewed here:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<p><img src="http://www.talkphp.com/images/build1.jpg" width="400" height="240" /></p>
<p><img src="http://www.talkphp.com/images/build2.gif" width="500" height="10" /></p>
<form id="form1" name="form1" method="post" action="process.php">
  <label><strong>INFORMATION</strong><br />
  <br />
  Name:
  <input type="text" name="name" />
  </label>
  <p>
    <label>Phone:
    <input type="text" name="phone" />
    </label>
  </p>
  <p>
    <label>Email:
    <input type="text" name="email" />
    </label>
  </p>
  <p><strong>PACKAGE OPTIONS</strong></p>
  <p>
    <label>Number of People:
    <input name="numPeople" type="text" size="4" id="numPeople" />
    </label>
    <label>Start Date:
    <select name="select[]">
      <option selected="selected">Jan</option>
      <option>Feb</option>
      <option>Mar</option>
      <option>Apr</option>
      <option>May</option>
      <option>June</option>
      <option>July</option>
      <option>Aug</option>
      <option>Sept</option>
      <option>Oct</option>
      <option>Nov</option>
      <option>Dec</option>
    </select>
    </label>
    <label>
    <select name="select[]">
      <option selected="selected">1</option>
      <option>2</option>
      <option>3</option>
      <option>4</option>
      <option>5</option>
      <option>6</option>
      <option>7</option>
      <option>8</option>
      <option>9</option>
      <option>10</option>
      <option>11</option>
      <option>12</option>
      <option>13</option>
      <option>14</option>
      <option>15</option>
      <option>16</option>
      <option>17</option>
      <option>18</option>
      <option>19</option>
      <option>20</option>
      <option>21</option>
      <option>22</option>
      <option>23</option>
      <option>24</option>
      <option>25</option>
      <option>26</option>
      <option>27</option>
      <option>28</option>
      <option>29</option>
      <option>30</option>
      <option>31</option>
    </select>
    <select name="select[]">
      <option>2008</option>
      <option>2009</option>
    </select>
    </label>
  </p>
  <p>How many of the inputted number of people are men? 
    <label>
    <input name="men" type="text" size="4" id="men" />
    </label>
  </p>
  <p><strong>SERVICES (click all that apply) </strong></p>
  <p>
    <label>Bachelor Party
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label> Bachelorette Party
    <input type="checkbox" name="check[]" value="checkbox" />
    Limo
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>Golf Outing
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>Ranch Run
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>Nightclub Crawl
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>VIP Entry
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
  </p>
  <p>
    <label>Bottle Service
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>Private Vacation
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>Show or Event tickets
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>Recreation
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>Business Service
    <input type="checkbox" name="check[]" value="checkbox" />
    </label>
    <label>Other:
    <input type="text" name="textfield6" />
    </label>
  </p>
  <p><strong>OTHER COMMENTS</strong></p>
  <p>
    <label>
    <textarea name="message" cols="44" rows="10"></textarea>
    </label>
</p>
  <p>
    <label>
    <input name="Submit" type="submit" onclick="mailto:sales@kevincollignon.com" value="Submit" />
    </label>
  </p>
  <p><strong>If you have any questions or concerns please contact one of our re</strong></p>
  <p><strong>presentatives at (702) 575-4557 </strong></p>
  <p>&nbsp;</p>
</form>
<p>&nbsp;</p>
</body>
</html>
__________________
Michael.Froseth
www.michaelfroseth.com | Personal Portfolio/Blog *DOWN*

Last edited by mike.fro : 07-06-2008 at 01:53 AM.
Send a message via AIM to mike.fro Send a message via MSN to mike.fro
mike.fro is offline  
Reply With Quote
Old 07-06-2008, 01:16 AM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Other than no error checking on your incoming data? *poke,poke,nudge,nudge* Just messing with you.

Are you getting any error messages returned? Or is it just timing out?

I'm guessing you've got your PHP.ini set to the correct smtp or sendmail?
-m
delayedinsanity is offline  
Reply With Quote
Old 07-06-2008, 01:21 AM   #3 (permalink)
Super ModTastic
 
mike.fro's Avatar
 
Join Date: Apr 2005
Location: Apple Valley, MN
Posts: 89
Thanks: 1
mike.fro is on a distinguished road
Default

Nevermind got it. I am just having problems with the checkboxes. I had the submit named wrong so it wasn't going to the proper page.

EDIT: Yeah I got lazy and didn't do any error checking :D but I figured it out. Was missing a few fields and some spelling errors haha.
__________________
Michael.Froseth
www.michaelfroseth.com | Personal Portfolio/Blog *DOWN*

Last edited by mike.fro : 07-06-2008 at 01:53 AM.
Send a message via AIM to mike.fro Send a message via MSN to mike.fro
mike.fro is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:13 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design