PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
aladiyat23
Forum Newbie
Posts: 3 Joined: Mon Sep 14, 2009 10:29 pm
Post
by aladiyat23 » Mon Sep 14, 2009 10:38 pm
Hi,
I modified some old code of mine and cant get a form to work.. can someone look at it and see what I'm missing?
Here's my send code:
Code: Select all
<?php
$to = "REMOVED@gmail.com";
$subject = "Proposal Request";
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$website=$_POST['website'];
$time=$_POST['time'];
$more=$_POST['more'];
$company=$_POST['company'];
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
$message = "
Name:$name\n
Phone: $phone\n
Best Time to Call: $time\n
Website: $website\n
Company: $company\n
Project Details: $more\n";
if($sent)
{
echo '<META HTTP-EQUIV="REFRESH" CONTENT="1;URL=http://www.REMOVED.html">'; }
else
{
echo "Mail returned false: ".$sent; }
?>
Here's my form (just a snippet):
Code: Select all
<form action="http://removed.php" method="post">
<label class="description">Name </label>
<input name="name" id="name" class="element text" maxlength="255" value="" size="36" type="text"/>
<label class="description">Email </label>
<input name="email" id="email" class="element text medium" type="text" maxlength="255" value=""/>
Im getting a mail returned false error...
Any help is greatly appreciated.. THANKS!
Eric!
DevNet Resident
Posts: 1146 Joined: Sun Jun 14, 2009 3:13 pm
Post
by Eric! » Mon Sep 14, 2009 11:39 pm
Do you have a SMTP mail installed on this server? What was the values of $sent?
aladiyat23
Forum Newbie
Posts: 3 Joined: Mon Sep 14, 2009 10:29 pm
Post
by aladiyat23 » Mon Sep 14, 2009 11:57 pm
SMTP is set to localhost, I'm sorry.. what do you mean by the value of $sent? When I hit submit, its echoing the error "mail returned false"
Sorry, my php is limited that's why I reuse everything and just tweek.
Thank you!
Eric!
DevNet Resident
Posts: 1146 Joined: Sun Jun 14, 2009 3:13 pm
Post
by Eric! » Tue Sep 15, 2009 8:00 am
add this to the top of your php file:
Try this on line 13 instead:
Code: Select all
$sent=mail("youremail@whatever.com","Subject","Hello.");and see if that gets through as an experiment.
aladiyat23
Forum Newbie
Posts: 3 Joined: Mon Sep 14, 2009 10:29 pm
Post
by aladiyat23 » Tue Sep 15, 2009 10:26 am
I added the error reporting line and still getting same echo "Mail returned false:" and thats it
I also changed the $sent info
Thank you!
Eric!
DevNet Resident
Posts: 1146 Joined: Sun Jun 14, 2009 3:13 pm
Post
by Eric! » Tue Sep 15, 2009 6:58 pm
aladiyat23 wrote: I also changed the $sent info
Thank you!
So did the new mail() statement work or not? If not, I suggest you check with your host provider to see if an SMTP server is running on your host and is configured for PHP.