Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

php mailer

Featured Replies

hi, anyone know why my php mailer doesn't send all the info in the form?

i have used the code from a smaller contact form that does work

hmmn...

 

 

<?php

$to =  "me@myemail.com";
$subject = "Web Contact";
$org_name = $_POST['org_name'];
$presentation_name = $_POST['presentation_name'];
$name_field = $_POST['name'];				
$email_field = $_POST['email'];
$mobile = $_POST['mob_number'];
$group_size = $_POST['total_group'];
$veggie = $_POST['veggie'];
$vegan = $_POST['vegan'];
$allergy_issues = $_POST['diet_allergy'];
$tables = $_POST['tables_req'];
$water = $_POST['water_req'];
$sockets = $_POST['sockets'];
$laptops_needed = $_POST['laptops_needed'];
$projectors_needed = $_POST['projectors_needed'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
$success = mail($to, $subject, $body);

if ($success){
 header("location:http://www.xxxxxxxx.com/thanks.html");

} else {

echo "Sorry error please try again...";

}
?>

Hi there,

 

Because the 'body' of your email does not contain the variables you have added to the form... currently you have..

 

$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";

 

And so you see the body only contains the $name_field,$email_field and $message.. you need to add all your other stuff too...

 

example...

 

$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message\n Veggie: $veggie \n Org Name: $org_name ..etc ";

 

All the best,

James

  • Author

hey James, thanks for the advice... still can't get it working... is this what you meant?

 

$org_name = $_POST['org_name'];
$presentation_name = $_POST['presentation_name'];
$name_field = $_POST['name'];				
$email_field = $_POST['email'];
$mobile = $_POST['mob_number'];
$group_size = $_POST['total_group'];
$veggie = $_POST['veggie'];
$vegan = $_POST['vegan'];
$allergy_issues = $_POST['diet_allergy'];
$tables = $_POST['tables_req'];
$water = $_POST['water_req'];
$sockets = $_POST['sockets'];
$laptops_needed = $_POST['laptops_needed'];
$projectors_needed = $_POST['projectors_needed'];
$message = $_POST['message'];
$body = "Org-Name: $org_name\n Presentation-Name: $preentation_name \n From: $name_field\n E-Mail: $email_field\n Name: $name \n Mobile: $mobile \n Group-Size: $total_group \n Veggie: $veggie \n Vegan: $vegan\n Allergies: $diet_allergy \n Table-Req: $tables_req \n Water: $water_req \n Sockets: $sockets \n Laptops-Needed: $laptops_needed \n Projectors-Needed: $projectors_needed \n Other-Message: $message  \n";
$success = mail($to, $subject, $body);

 

ta, eighty0ne

Hi there,

 

That is what I meant yes - what does it email you now? some of them or none of them?

 

Some of them are incorrect in your body mind... for example you have typed ... "Water: $water_req.." yet in your define section you define the variable $water, not $water_req.

 

That aside some of them are ok so you should be seeing them, can I see your HTML form code aswell?

 

Cheers,

  • Author

hey James, yeah...

 

it's only sending me

 

From:

E-Mail:

Message:

 

in the emails...

 

here is the full html <form>

 

<form method="POST" action="../info/mailer.php">
 <table width="100%" border="1" cellspacing="2" cellpadding="2">
   <tr>
	 <td>Organisation</td>
	 <td><input name="org_name" type="text" id="org_name" size="30" /></td>
   </tr>
 <tr>
<td>Presentation Title</td>
<td><input name="presentation_name" type="text" id="presentation_name" size="30" /></td>
 </tr>
 <tr>
<td>Brief Description</td>
<td><label>
  <textarea name="description" id="description" cols="30" rows="5">What will you be bringing/doing...</textarea>
</label></td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td width="35%">Contact Name</td>
<td width="65%"><input type="text" name="name" size="30" /></td>
 </tr>
 <tr>
<td>Contact Email</td>
<td><input type="text" name="email" size="30" /></td>
 </tr>
 <tr>
<td>Contact Mobile</td>
<td><label>
  <input type="text" name="mob_number" id="mob_number" />
</label></td>
 </tr>
 <tr>
<td>Total Group Size</td>
<td><label>
  <select name="total_group" id="total_group">
	<option value="1">1</option>
	<option value="2">2</option>
	<option value="3">3</option>
	<option value="4">4</option>
	<option value="5">5</option>
	<option value="6">6</option>
	<option value="7">7</option>
	<option value="8">8</option>
  </select>
</label></td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td class="feature_header">CATERING</td>
<td>Brighton Science Festival will be providing each member of your group with a packed lunch, including a soft drink. There will also be free hot drinks available throughout the day for all presenters/exhibitors.</td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td>Vegetarians?</td>
<td><select name="veggie" id="veggie">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select></td>
 </tr>
 <tr>
<td>Vegans?</td>
<td><select name="vegan" id="vegan">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select></td>
 </tr>
 <tr>
<td>Allergies/Dietary</td>
<td><label>
  <textarea name="diet_allergy" id="diet_allergy" cols="30" rows="2">Please give details...</textarea>
</label></td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td class="feature_header">EQUIPMENT</td>
<td> </td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td>Tables Required?</td>
<td><select name="tables_req" id="tables_req">
  <option value="0">0</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
</select> 
  (Exam Tables 45cm x 45cm)</td>
 </tr>
 <tr>
<td>Water Required?</td>
<td><select name="water_req" id="water_req">
  <option value="Yes">Yes</option>
  <option value="No">No</option>
</select></td>
 </tr>
 <tr>
<td> </td>
<td>Please note that we are unable to supply running water directly but water can be supplied from a tap elsewhere and brought to you if needed.</td>
 </tr>
 <tr>
<td>Power Supply?</td>
<td><select name="sockets" id="sockets">
  <option value="0">0</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
</select>
  (Sockets)</td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td class="feature_header">OTHER EQUIPMENT</td>
<td><p>Brighton Science Festival  are able to supply a very small number of pieces of technical equipment.  However, we ask where possible that you bring your own.  This usually saves on a lot of technical issues with unfamiliar equipment. </p>
  <p>Please note that there will be a data projector set up in the talks room.</p></td>
 </tr>
 <tr>
<td>Laptop/s Needed</td>
<td><select name="laptops_needed" id="laptops_needed">
  <option value="0">0</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
</select></td>
 </tr>
 <tr>
<td>Projector/s Needed</td>
<td><select name="projectors_needed" id="projectors_needed">
  <option value="0">0</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
</select></td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td class="feature_header">HELPERS</td>
<td>We have a number of volunteers who will be available to help you out during the day. We would like to avoid assigning volunteers to particular areas but if you feel that you will be requiring extra help, please let us know.</td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td class="feature_header">EXPENSES</td>
<td>Brighton Science Festival will cover your travel expenses to and from the event, within reason. Please provide us (FAO Richard Robinson) with full receipts of train and/or bus fares, petrol, etc at your earliest convenience.</td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td>PARKING</td>
<td><p>For Bright Sparks and White Heat, parking will be available at Hove Park School, near the Main Hall.</p>
  For Big Science, you will need to unload and then find a parking space in the area. There is an NCP Car Park just up the road. Please keep all your receipts.</td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td>RISK ASSESMENTS</td>
<td><p>All presenters/exhibitors will be required to provide a full risk assessment at their earliest convenience.</p>
  <p>These should be emailed to Joe <a href="mailto:joe@brightonscience.com">here</a> - who can also send you a template if required.</p></td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
 <tr>
<td>Other Comments</td>
<td><textarea rows="9" name="message" cols="30">Anything else you think we should know...</textarea></td>
 </tr>
 <tr>
<td> </td>
<td><input type="submit" value="Submit" name="submit" /></td>
 </tr>
 <tr>
<td> </td>
<td> </td>
 </tr>
</table>
  </form>

  • Author

have also patched up those errors but still no luck

 

$org_name = $_POST['org_name'];
$presentation_name = $_POST['presentation_name'];
$name_field = $_POST['name'];				
$email_field = $_POST['email'];
$mobile = $_POST['mob_number'];
$group_size = $_POST['total_group'];
$veggie = $_POST['veggie'];
$vegan = $_POST['vegan'];
$allergy_issues = $_POST['diet_allergy'];
$tables = $_POST['tables_req'];
$water = $_POST['water_req'];
$sockets = $_POST['sockets'];
$laptops_needed = $_POST['laptops_needed'];
$projectors_needed = $_POST['projectors_needed'];
$message = $_POST['message'];
$body = "Org-Name: $org_name\n Presentation-Name: $presentation_name \n From: $name\n E-Mail: $email_field\n Mobile: $mobile \n Group-Size: $group_size \n Veggie: $veggie \n Vegan: $vegan\n Allergies: $allergy_issues \n Table-Req: $tables_req \n Water: $water_req \n Sockets: $sockets \n Laptops-Needed: $laptops_needed \n Projectors-Needed: $projectors_needed \n Other-Message: $message  \n";
$success = mail($to, $subject, $body);

Hi eightyone

 

I copied your above code onto my server and changed email to mine and it ran fine.. http://www.madcapsule.com/dev/eightyone

 

it emailed me:

Org-Name: zxczxc

Presentation-Name:

From: zxczxc

E-Mail: zxczxc@ccc.com

Mobile:98098098

Group-Size: 1

Veggie: 0

Vegan: 0

Allergies: Please give details...

Table-Req: 0

Water: Yes

Sockets: 0

Laptops-Needed: 0

Projectors-Needed: 0

Other-Message: Anything else you think we should know...

 

Do you not even get the text titles in your email.. such as 'Sockets:' and 'Water'? If not then I would suggest maybe the page isn't being saved or you are updating the wrong page?

 

cheers,

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.