Page 1 of 1

newbie needs help, form will not submit, i get an error

Posted: Mon Jul 14, 2003 4:06 am
by Phatoutlaw
I was doing a tutorial, for a form that visitors at a website type their email and a message to send to the webmasters email. I get an error when i submit the information while testing on my server.

I am running this on an apache server I installed on my comp.

this is the form code, for mailform.php

Code: Select all

<form method="post" action="sendmail.php">
Email: <input type="text" name="email" /><br />
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
then this is the code for the sendmail.php file

Code: Select all

<?
$email = $_REQUEST&#1111;'email'] ;
$message = $_REQUEST&#1111;'message'] ;


if (!isset($_REQUEST&#1111;'email'])) &#123;
header( "Loacation: http://localhost/feedback.html" );

&#125;
elseif (empty($email) || empty($message)) &#123;
  header( "Location: http://localhost/error.html" );
&#125;
else &#123;
  mail( "Phatoutlaw@aol.com", "Feedback Form Results",
    $message, "From: $email" );
header( "Location: http://localhost/thankyou.html" );
&#125;
?>
and this is the error I get

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in d:\program files\apache group\apache\htdocs\sendmail.php on line 15

Warning: Cannot modify header information - headers already sent by (output started at d:\program files\apache group\apache\htdocs\sendmail.php:15) in d:\program files\apache group\apache\htdocs\sendmail.php on line 16

Posted: Mon Jul 14, 2003 4:51 am
by twigletmac
Is this on your own or a hosts server?

Mac

Posted: Mon Jul 14, 2003 10:38 am
by Phatoutlaw
This is on my own server... I think that, maybe I configured something wrong or something cause this was my frist time installing it.

Posted: Mon Jul 14, 2003 11:03 am
by m3rajk
what is the environment of the server? ie: Windows IIS MySQL PHP (WIMP), Linux Apache MySQL PHP (LAMP), etc

Posted: Mon Jul 14, 2003 12:17 pm
by alexus
Try this structure:

Code: Select all

<?
if(isset($submit)){
	Print("The script goes here, and will exe.");
}else{
	print("You can put you form here, so it wont appear after you press submit");
}
?>
<form action="<? print($PHP_SELF);?>" method="post">
<input type="submit" value="Submit" name="submit">
</form>

?>
I just added the name to the button and with the if operator checked if the instance name has been submitted

Posted: Mon Jul 14, 2003 2:24 pm
by Phatoutlaw
I am running an apache server, and alexus thanks I'll try that

Posted: Tue Jul 15, 2003 6:34 am
by twigletmac
alexus wrote:Try this structure:

Code: Select all

<?
if(isset($submit)){
	Print("The script goes here, and will exe.");
}else{
	print("You can put you form here, so it wont appear after you press submit");
}
?>
<form action="<? print($PHP_SELF);?>" method="post">
<input type="submit" value="Submit" name="submit">
</form>

?>
I just added the name to the button and with the if operator checked if the instance name has been submitted
Alexus - Please read the thread in my link and avoid posting code that won't work with register_globals off - it causes confusion because it won't work for anyone with a default installation of PHP 4.2 and above (plus it is deprecated).

Mac

Posted: Tue Jul 15, 2003 6:36 am
by twigletmac
Phatoutlaw wrote:I am running an apache server, and alexus thanks I'll try that
On *nix or Windows?

Mac