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

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

Post Reply
Phatoutlaw
Forum Newbie
Posts: 3
Joined: Mon Jul 14, 2003 4:06 am

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

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Is this on your own or a hosts server?

Mac
Phatoutlaw
Forum Newbie
Posts: 3
Joined: Mon Jul 14, 2003 4:06 am

Post 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.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

what is the environment of the server? ie: Windows IIS MySQL PHP (WIMP), Linux Apache MySQL PHP (LAMP), etc
alexus
Forum Contributor
Posts: 159
Joined: Fri Jul 04, 2003 10:49 pm

Post 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
Phatoutlaw
Forum Newbie
Posts: 3
Joined: Mon Jul 14, 2003 4:06 am

Post by Phatoutlaw »

I am running an apache server, and alexus thanks I'll try that
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Phatoutlaw wrote:I am running an apache server, and alexus thanks I'll try that
On *nix or Windows?

Mac
Post Reply