Jump to content

Have a couple of hours to get this working :(!! Plz help


soupy127

Recommended Posts

I have this form set up

<form action="emailbooking.php" method="send">

<table>

<tr>

<td>Name:</td>

<td>

<input type="text" name="name" value="" maxlength="100" /></td>

</tr>

<tr>

<tr><td>To:</td>

<td><select name="email">

  <option value ="[email protected]">Royal Portrush Golf Club</option>

  <option value ="[email protected]">Royal County Down Golf Club</option>

  <option value ="[email protected]">Portstewart Golf Club</option>

  <option value ="[email protected] ">Moyola Park Golf Club</option>

  <option value ="[email protected]">Belvoir Park Clubhouse</option>

  <option value ="[email protected]">Castle Rock Golf Club</option>

  <option value ="[email protected]">Ardglass Golf Club</option>

</select></td>

 

<tr><td>From(Email Address): </td>

<td>

<input type="text" name="emailfrom" value="" maxlength="200" /></td>

</tr>

<tr><td>Subject: </td>

<td>

<input type="text" name="subject" value="" maxlength="75" /></td>

 

</tr>

<tr>

<td>Query:</td>

<td>

<textarea rows="3" cols="20" name="query"></textarea></td>

</tr>

<tr><td> </td>

<td>

<input type="submit" value="Send" /></td>

</tr>

</table>

 

 

just wandering how I can make the from send to whatevery email address the user selects from the drop down menu?? any ideas, any help would be greatly appreciated :)!! thanks

<form action="emailbooking.php" method="post">
<table>
<tr>
<td>Name:</td>
<td>
<input type="text" name="name" value="" maxlength="100" /></td>
</tr>
<tr>
<tr><td>To:</td>
<td><select name="email">
  <option value ="[email protected]">Royal Portrush Golf Club</option>
  <option value ="[email protected]">Royal County Down Golf Club</option>
  <option value ="[email protected]">Portstewart Golf Club</option>
  <option value ="[email protected] ">Moyola Park Golf Club</option>
  <option value ="[email protected]">Belvoir Park Clubhouse</option>
  <option value ="[email protected]">Castle Rock Golf Club</option>
  <option value ="[email protected]">Ardglass Golf Club</option>
</select></td>

<tr><td>From(Email Address): </td>
<td>
<input type="text" name="emailfrom" value="" maxlength="200" /></td>
</tr>
<tr><td>Subject: </td>
<td>
<input type="text" name="subject" value="" maxlength="75" /></td>

</tr>
<tr>
<td>Query:</td>
<td>
<textarea rows="3" cols="20" name="query"></textarea></td>
</tr>
<tr><td> </td>
<td>
<input type="submit" value="Send" name="submit"/></td>
</tr>
</table>
<?php 
if (isset($_POST['submit'])) {
     $to      = $_POST['email'];
     $subject = $_POST['subject'];
     $message = $_POST['query'];
     $from    = $_POST['emailfrom'];
     $headers = 'From:' . $from . '<' . $from . '>';
     
     mail($to, $subject, $message, $headers);
     
     echo 'Message sent';
}
?>

 

Something like that.

Mm, it worked for me. (The echo came up). However, I cannot check if the email was sent correctly. Pretty sure what the problem is, if you didn't receive an email.

 

<form action="emailbooking.php" method="post">
<table>
<tr>
<td>Name:</td>
<td>
<input type="text" name="name" value="" maxlength="100" /></td>
</tr>
<tr>
<tr><td>To:</td>
<td><select name="email">
  <option value ="[email protected]">Royal Portrush Golf Club</option>
  <option value ="[email protected]">Royal County Down Golf Club</option>
  <option value ="[email protected]">Portstewart Golf Club</option>
  <option value ="[email protected] ">Moyola Park Golf Club</option>
  <option value ="[email protected]">Belvoir Park Clubhouse</option>
  <option value ="[email protected]">Castle Rock Golf Club</option>
  <option value ="[email protected]">Ardglass Golf Club</option>
</select></td>

<tr><td>From(Email Address): </td>
<td>
<input type="text" name="emailfrom" value="" maxlength="200" /></td>
</tr>
<tr><td>Subject: </td>
<td>
<input type="text" name="subject" value="" maxlength="75" /></td>

</tr>
<tr>
<td>Query:</td>
<td>
<textarea rows="3" cols="20" name="query"></textarea></td>
</tr>
<tr><td> </td>
<td>
<input type="submit" value="Send" name="submit"/></td>
</tr>
</table>
<?php 
if (isset($_POST['submit'])) {
     $name = $_POST['name'];
     $to      = $_POST['email'];
     $subject = $_POST['subject'];
     $message = $_POST['query'];
     $from    = $_POST['emailfrom'];
     $headers = 'From:' . $name . '<' . $from . '>';
     
     mail($to, $subject, $message, $headers);
     
     echo 'Message sent';
}
?>

 

This works fine for me, I've tried it on my own email address on my server.

getting this error

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\Final\adminbookingform.php on line 88

Message sent 

 

think it might go away when i upload it to my website, hopefully that will fix the problem :)!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.