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 ="info@royalportrushgolfclub.com">Royal Portrush Golf Club</option>

  <option value ="golf@royalcountydown.org">Royal County Down Golf Club</option>

  <option value ="bill@portstewartgc.co.uk">Portstewart Golf Club</option>

  <option value ="moyolapark@btconnect.com ">Moyola Park Golf Club</option>

  <option value ="info@belvoirparkclubhouse.co.uk">Belvoir Park Clubhouse</option>

  <option value ="info@castlerockgc.co.uk">Castle Rock Golf Club</option>

  <option value ="info@ardglassgolfclub.com">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

Link to comment
Share on other sites

<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 ="info@royalportrushgolfclub.com">Royal Portrush Golf Club</option>
  <option value ="golf@royalcountydown.org">Royal County Down Golf Club</option>
  <option value ="bill@portstewartgc.co.uk">Portstewart Golf Club</option>
  <option value ="moyolapark@btconnect.com ">Moyola Park Golf Club</option>
  <option value ="info@belvoirparkclubhouse.co.uk">Belvoir Park Clubhouse</option>
  <option value ="info@castlerockgc.co.uk">Castle Rock Golf Club</option>
  <option value ="info@ardglassgolfclub.com">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.

Link to comment
Share on other sites

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 ="info@royalportrushgolfclub.com">Royal Portrush Golf Club</option>
  <option value ="golf@royalcountydown.org">Royal County Down Golf Club</option>
  <option value ="bill@portstewartgc.co.uk">Portstewart Golf Club</option>
  <option value ="moyolapark@btconnect.com ">Moyola Park Golf Club</option>
  <option value ="info@belvoirparkclubhouse.co.uk">Belvoir Park Clubhouse</option>
  <option value ="info@castlerockgc.co.uk">Castle Rock Golf Club</option>
  <option value ="info@ardglassgolfclub.com">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.

Link to comment
Share on other sites

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 :)!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.