View Full Version : refresh issue

04-15-2004, 02:18 PM
basically i had a php script i had downloaded and tried to add it to my own existing html form. the script i downloaded worked fine.

if ($submit) { // if the form was sent do the following

if($Fname && $phone && $email && $message ) { // if all field are filled-in send email
mail("thefuzmixman@yahoo.com","$phone","$message","From: $Fname <$email>") or die("email error");
echo "Message Sent"; // if all went well, display message was sent
} else {
echo "All fields must be filled in!<BR>"; // if not all were filled in, display error message
} // end php submission code

when i added this information, i changed the variables to suit my own needs, but the script no longer worked. i found that i needed to add 2 hidden fields

<input type="hidden" name="mailTo" value="myaddress@domain.com">
<input type="hidden" name="Subject" value="Comment from Domain.com">

and viola... problem solved. also i didnt specify an action for the form. in the downloaded version there wasnt one either, however i used this.....

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

another thing that was messed up was the mail() variable order.
When i used "mailto/message/xheaders" it was sending the message body as the subject and nothing as a message. lol..

when i used "mailto/subject/message/xheaders" everything was fine. so i supposed one should not tamper with order here. :eek:

04-15-2004, 02:30 PM

Secondly, put the PHP code block at the top of the file

Thirdly, check for $_POST['submit'], not just $submit


04-15-2004, 03:59 PM
zigo86 , continue with replies like that and your stay at CF will we short if not sweet , this is a help forum with users of ALL abilites and all are welcome , if you simply forgot the smiley in your post which would have put it in a different light I apologise , else ... well then I don't ;)

04-15-2004, 04:18 PM
did i tick that person off..? lol. ok then. well all i got was the second thing. something about globals? yea a friend sent me to a page, but i didnt get it. But i mean if the original script does work (uploaded it, tested it, and got an email)

about the php code being atop the html, that wasn't how it was in the script.

04-15-2004, 08:43 PM
Welcome here thefuzmixman !

There is no need to remove your initial post after the problem (or whatever it was) is solved. It would be nicer to leave it on and maybe point out how you solved it, so that other people possiby could learn something from it, or so that other people probably might point out some stuff you could optimize or whatever.

04-16-2004, 04:17 AM
aw.. im sorry. i didnt really even think about that. :( I'll remember that in future posts