Jump to content

php mail code wrong???


soulroll

Recommended Posts

hi, i have a problem. my php mail, doesnt send mails... easy for you guys...but not for me...

have another problem,dont know how to code in php the 'payment choose" field, where you can choose 3 different payments...

 

here is the link to the site:  http://www.bracksconsulting.com/index-6.html

 

here the html code:

 <form method="post" action="mail.php">
                    <p>
                      <input type="text" name="name" size="19" />
                      Name<br />
                      <br />
                      <input type="text" name="position" size="19" id="position" />
                      Position<br />
                      <br />
                      <input type="text" name="business name" size="19" id="business name" />
                      Business Name<br />
                      <br />
                      <input type="text" name="address" size="19" id="address" />
                      Business Address</p>
			    <p>
                      <input type="text" name="phone" size="19" id="phone" />
			      Business Phone</p>
			    <p>
                      <input type="text" name="web" size="19" id="web" />
			      Business Web Address</p>
			    <p>
                      <input type="text" name="email" size="19" id="email" />
		        Email Address </p>
			    <p>
			      <input type="text" name="number" size="19" id="number" />
			      Number of books to order@ $26 per book</p>
			    <p>
  <select name="Payment" size="1" id="Payment">
   <option value="Credit Card">Credit Card</option>
   <option value="Cheque">Cheque</option>
   <option value="Direct Funds Transfer" selected="selected">Direct Funds Transfer</option>
</select>
Method of payment<br />
			      <br />
			      <input type="submit" value="Submit" name="submit" />
			      <br />
		        </p>
		      </form>
			</div>

 

and here the php:

<?php
// Contact subject
$name ="$name"; 
// Details
$position="$position";
$business name="$business name";
$address="$address";
$phone="$phone";
$web="$web";$address="$address";
$number="$number";


// Mail of sender
$mail_from="$email"; 
// From 
$header="from: $name <$mail_from>";

// Enter your email address
$to ='[email protected]';

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/
Share on other sites

What's this:

 

// Contact subject
$name ="$name"; 
// Details
$position="$position";
$business name="$business name";
$address="$address";
$phone="$phone";
$web="$web";$address="$address";
$number="$number";

 

Are you supposed to be getting it from the form?

 

Try this:

// Contact subject
$name = $_POST['name'];
// Details
$position= $_POST['position'];
$business_name= $_POST['business_name'];
$address= $_POST['address'];
$phone= $_POST['phone'];
$web= $_POST['web'];
$address= $_POST['address'];
$number=$_POST['number'];

 

I also made business name business_name, so in your HTML form you should change it to an underscore instead of a space. I wouldn't recommend using spaces in field names.

Link to comment
https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624201
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.