Jump to content

PHP Script form Send HELP


adman32

Recommended Posts

I have a new website which is using a php form send script for email enquiries.  The old website was using a php script which worked fine but the new site has a problem with the script.  

 

The builder of the site (who is currently on holidays and uncontactable) provided the form send script which sends a email to me notifying that someone has used the site to send an email but the email doesn't contain any information.  I just get an email saying that an enquiry has been submitted through the site.  No name, email or message.

 

Also the script doesn't send the person after they hit submit to the thank you for contacting us page it just provides a plain text message on a blank page.  I have a thank you page set up but not sure what code needs to be used to send it to that page.

 

I am sure something like this is here somewhere but whilst I have a reasonably good knowledge of html I don't understand php at all and was wondering if someone could please help.

 

The script for the form send I have been given is 

 

 

 
<script language="php">
$email = $HTTP_POST_VARS;

 

 

And the code on the page is 

 

 

Link to comment
Share on other sites

here is after modification, it's very basic the programmer must work on it or you can use another script that has more features and security

it's just one file

<script language="php">
if (!empty($_POST)) {
 $email = $_POST['contact-email'];
$body = $_POST['contact-message'] ;
$name = $_POST['contact-name'];
$mailto = "info@globalfundraisinginitiative.com";
$mailsubj = "Enquiry From The GFI Website";
$mailhead = "From: info@globalfundraisinginitiative.com";
$headers = "To: info@globalfundraisinginitiative.com" . "\r\n" .
"CC: info@globalfundraisinginitiative.com";

$mailbody = "The following enquiry has been submitted via the GFI Website:\n";
$mailbody .= $body ."\n" ; // the message body
$mailbody .= "his email is ".$email ."\n" ; // the message body
$mailbody .= "his name is ".$name ."\n" ; // the message body


mail($mailto, $mailsubj, $mailbody, $mailhead);   
echo '<center><h1>Sent and thanks.</h1></center>';   
}

</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 
<title>Form Sent</title>
</head>
 
<body>




 
 

    
    <!-- Contact Form -->
<section class="footer-one">
<form id="contacts-form" action="" method="post">
<div>
<div class="row half">
<div class="6u">
<input type="text" class="text" name="contact-name" id="contact-name" placeholder="Name" />
</div>
<div class="6u">
<input type="text" class="text" name="contact-email" id="contact-email" placeholder="Email" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="contact-message" id="contact-message" placeholder="Message"></textarea>
</div>
</div>
<div class="row">
<div class="12u">
<ul class="actions">
<li><input type="submit" class="button button-style1" value="Send" /></li>
<li><input type="reset" class="button button-style2" value="Reset" /></li>
</ul>
</div>
</div>
</div>
</form>
</section>
<!-- /Contact Form -->

</body>
</html>

Link to comment
Share on other sites

if you want the form in a page and the php code whch process and showing the thank you message on another page make 2 separate page

the first

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 
<title>Form Sent</title>
</head>
 
<body>
    
    <!-- Contact Form -->
<section class="footer-one">
<form id="contacts-form" action="html_form_send.php" method="post">
<div>
<div class="row half">
<div class="6u">
<input type="text" class="text" name="contact-name" id="contact-name" placeholder="Name" />
</div>
<div class="6u">
<input type="text" class="text" name="contact-email" id="contact-email" placeholder="Email" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="contact-message" id="contact-message" placeholder="Message"></textarea>
</div>
</div>
<div class="row">
<div class="12u">
<ul class="actions">
<li><input type="submit" class="button button-style1" value="Send" /></li>
<li><input type="reset" class="button button-style2" value="Reset" /></li>
</ul>
</div>
</div>
</div>
</form>
</section>
<!-- /Contact Form -->

</body>
</html>
 

and save it as form.html for example

and create another page 

<script language="php">
if (!empty($_POST)) {
 $email = $_POST['contact-email'];
$body = $_POST['contact-message'] ;
$name = $_POST['contact-name'];
$mailto = "info@globalfundraisinginitiative.com";
$mailsubj = "Enquiry From The GFI Website";
$mailhead = "From: info@globalfundraisinginitiative.com";
$headers = "To: info@globalfundraisinginitiative.com" . "\r\n" .
"CC: info@globalfundraisinginitiative.com";

$mailbody = "The following enquiry has been submitted via the GFI Website:\n";
$mailbody .= $body ."\n" ; // the message body
$mailbody .= "his email is ".$email ."\n" ; // the message body
$mailbody .= "his name is ".$name ."\n" ; // the message body


mail($mailto, $mailsubj, $mailbody, $mailhead);   
echo '<center><h1>Sent and thanks.</h1></center>';   
}

</script>

and save it as html_form_send.php 

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.