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

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
Richking
Forum Newbie
Posts: 12
Joined: Thu Mar 09, 2006 8:14 am

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

Post 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
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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.
Richking
Forum Newbie
Posts: 12
Joined: Thu Mar 09, 2006 8:14 am

Post by Richking »

sorry that was just a cut and paste typo, the code is as you've put.
Richking
Forum Newbie
Posts: 12
Joined: Thu Mar 09, 2006 8:14 am

Post 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....
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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?
Richking
Forum Newbie
Posts: 12
Joined: Thu Mar 09, 2006 8:14 am

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Might want to check out using phpMailer.
Richking
Forum Newbie
Posts: 12
Joined: Thu Mar 09, 2006 8:14 am

Post 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!
Post Reply