It is currently Tue Jul 17, 2018 12:22 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: please help wth simple PHP mail form
PostPosted: Mon Feb 19, 2007 11:35 pm 
Noobie
Noobie

Joined: Mon Feb 19, 2007 11:11 pm
Posts: 3
Hi. I'm extremely new to PHP, which is probably why I'm encountering some trouble here. I am trying to design my own wedding website, and so far everything is working nicely, except for the newest addition: I embedded some form HTML into one page so that I could collect guests' address information and then use a PHP script to have it emailed to me. See page here: http://carlosandamy.us/infohome.html (and please ignore bad looking and wacky HTML and CSS design, I'm new to this!!!)

My hosting account allows for all of this, and the crazy part is that it works, sometimes. It seems to me that it works just fine when I use the "return" key on my keyboard to submit the form. I get redirected to the success page per my PHP script, and my email inbox receives the message.

But when I click the submit button, it doesn't work. I get redirected to the same success page, but no email is sent.

Here is my PHP script:
Code:
<?
// making this stuff into local values
$from = "from: me (at) hidingaddres.com";
$to = "us (at) carlosandamy.us";
$subject = "WeddingAddresses";
$Name = Trim(stripslashes($_POST['Name']));
$Street = Trim(stripslashes($_POST['Street']));
$City = Trim(stripslashes($_POST['City']));
$State = Trim(stripslashes($_POST['State']));
$Zip = Trim(stripslashes($_POST['Zip']));
$Email = Trim(stripslashes($_POST['Email']));

// creating email message
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Street: ";
$Body .= $Street;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Zip: ";
$Body .= $Zip;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";


// sending email
$success = mail($to, $subject, $Body, $from);

// success - redirecting to my home page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.carlosandamy.us\">";
}

// failure - redirecting to error version of home page
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=htt://www.carlosandamy.us/error.html\">";
}
?>


Does anyone have an explanation? Is something wrong with my PHP or with the code behind my submit button?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 1:40 am 
Experienced
Experienced

Joined: Fri Apr 28, 2006 9:49 pm
Posts: 50
Location: Texas
I had this same problem. In the email header, the "from" area needs to be an email account that you got with your 100WS hosting package. I don't think you get this with a free package, if that's what you're using. Otherwise, you're good. :)

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 20, 2007 1:55 am 
Noobie
Noobie

Joined: Mon Feb 19, 2007 11:11 pm
Posts: 3
Thanks, scorpian. I am on a paid hosting account, and the address in the from field is one of my accounts.

This is driving me nuts. It definitely works when I hit the "return" key after filling out the form. Just not when I push the button.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ]  Moderators: fhmagic, KJ, Support Team, Moderators

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
100WebSpace © 2011