Page 1 of 1

Php form was working now isn't....aaaarrrgggghhh

Posted: Thu Mar 16, 2006 5:43 am
by Richking
Hi there thanks to some kind help from this forum i sorted out a form being sent by php....all great. Out of nowhere now it's not working.

This is what i've changed the php.ini file settings to:

Code: Select all

[mail function]
; For Win32 only.
SMTP = smtp.*******.co.uk
smtp_port = 25

; For Win32 only.
;sendmail_from = ****@**********.com
the form code is

Code: Select all

<form action="booking.php" method="post">
  <table width="700" border="0">
    <tr>
      <td width="93">Name </td>
      <td width="237"><input type="text" name="username" size="35"/></td>
      <td width="23">&nbsp;</td>
      
    </tr>
    <tr>
      <td>Email </td>
      <td><input type="text" name="usermail" size="35"/></td>
      <td>&nbsp;</td>
</tr>
         <tr>
      <td>Address</td>
      <td><input type="text" name="useraddr" size="35"/></td>
      <td>&nbsp;</td>
 </tr>
           <tr>
    
      <td> 
          <div align="left">
            <input type="submit" value="Send details">
          </div></td>
  </tr>

  </table>

Code: Select all

<?
$to="****@***********.com";
$subject="FPRU Booking Form";
$message=$message=$_POST['username'] . "\n" . $_POST['usermail'] . "\n" . $_POST['useraddr'];
mail($to,$subject,$message);
?>
Problem is as i say this was working two days ago, nothing has changed but it's now not happening - any ideas?

Thanks

Posted: Thu Mar 16, 2006 5:47 am
by shiznatix

Code: Select all

$message=$message=$_POST['username'] . "\n" . $_POST['usermail'] . "\n" . $_POST['useraddr'];
what are you doing there? wouldn't that give a parse error? try making it just

Code: Select all

$message=$_POST['username'] . "\n" . $_POST['usermail'] . "\n" . $_POST['useraddr'];
and put error_reporting(E_ALL); at the top of your script.

Posted: Thu Mar 16, 2006 6:09 am
by Richking
sorry that was just a cut and paste typo, the code is as you've put.

Posted: Thu Mar 16, 2006 6:22 am
by Richking
I've just checked it on my testing server it's now coming back with this message as well....


Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\xampp\htdocs\football\booking.php on line 10


However the php.ini is set.......this is driving me nuts!

The smtp details i entered in php.ini are from my isp
the sendmail_from is from my email address, which is different to the main address for the site i'm doing - should that make a difference. thing is when i put it from my address that didn't work either.

It was all working 2 days ago....

Posted: Thu Mar 16, 2006 7:11 am
by shiznatix
Wait, are you doing this on a local machine? your ISP is not going to have a smtp server intalled on your computer. This was working from the same machine?

Posted: Thu Mar 16, 2006 7:24 am
by Richking
i just tried it on local, it was working externally before. i've scrapped trying to fix it locally, it was just getting more confusing.

Posted: Thu Mar 16, 2006 8:19 am
by feyd
Might want to check out using phpMailer.

Posted: Thu Mar 16, 2006 3:51 pm
by Richking
I've had a good couple of hours trying to fathom out php mailer......that's going to take some time to get my head around.

What i can't understand is that the code was working initially and now isn't, and it seems to me to be much simpler to have that simple php code working rather than installing another program to do it.

Thanks anyway!