soulroll Posted August 24, 2008 Share Posted August 24, 2008 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 More sharing options...
JasonLewis Posted August 24, 2008 Share Posted August 24, 2008 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 More sharing options...
soulroll Posted August 24, 2008 Author Share Posted August 24, 2008 thanks for the changes. the mail still doesnt come trough....why? Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624208 Share on other sites More sharing options...
coder500 Posted August 24, 2008 Share Posted August 24, 2008 $send_contact=mail($to,$subject,$message,$header); You haven't set subject and message anywhere... Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624287 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 The from address must be an email registered with the host on the server, no other emails will work. Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624290 Share on other sites More sharing options...
JasonLewis Posted August 25, 2008 Share Posted August 25, 2008 The from address must be an email registered with the host on the server, no other emails will work. Does it? I thought I made up an email address once and it worked. That's going by my memory, which can be pretty bad sometimes. Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624781 Share on other sites More sharing options...
DeanWhitehouse Posted August 25, 2008 Share Posted August 25, 2008 yer, on my host it has to be , as the registered email adress is the smtp username , i think, so it is needed to be correct, unless you use phpmailer Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624889 Share on other sites More sharing options...
JasonLewis Posted August 25, 2008 Share Posted August 25, 2008 I see. Must be a host thing. Just tried it on my server with a made up e-mail (I hope) and it was sent to me. That was just using the mail() function as well. Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624897 Share on other sites More sharing options...
DeanWhitehouse Posted August 25, 2008 Share Posted August 25, 2008 yer, are you on a private dedicated. Also i think it may be to reduce spam emails being sent. Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624898 Share on other sites More sharing options...
JasonLewis Posted August 25, 2008 Share Posted August 25, 2008 Yes it's my own server. I'm sure I could do it on my old host as well. I think it's a good idea. Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624906 Share on other sites More sharing options...
DeanWhitehouse Posted August 25, 2008 Share Posted August 25, 2008 yer, i am with awardspace , so theres my problem, lolz, it got me stuck for days trying to fix it. So i used phpmailer Link to comment https://forums.phpfreaks.com/topic/121081-php-mail-code-wrong/#findComment-624908 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.