Jump to content

Submit Form Problem


laflair13

Recommended Posts

I am putting together a website for the mother and her business. She wants a contact form so customers can contect her, instead of using an email.

I got some coding together but when I submit it the email comes in blank. Can any of ya help me out on this one.

Heres a look at the codes.

[code]<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br><br>
<form method="post" action="sendmail.php">
  Email: <input name="email" type="text" /><br />
  Name:<input type="text" name="name" size="20"><br />
  <br />
  <input type="submit" />
</form>
</body>
</html>[/code]

&

[code]<?
  $email = $_REQUEST['email'];
  $name = $_REQUEST['name'];

  mail( "dleflair@bellsouth.net", "Link Request",
    $message, "From: $email" );
  header( "Location: <a href="http://www.example.com/thankyou.html" target="_blank">http://www.example.com/thankyou.html</a>" );
?>
[/code]

There is only 2 feilds because I wanted to test it first before adding any more options. Like url, how they found her site (refered, search engine, blah, blah) which will be a drop down box.

Any help would be greatly appreciated.
Link to comment
Share on other sites

Well, since you're not putting any text in the variable $message, you're sending anything so you will get a blank message.

Change your form to include a message box:
[code]
html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br><br>
<form method="post" action="sendmail.php">
  Email: <input name="email" type="text" /><br />
  Name:<input type="text" name="name" size="20"><br />
  Message: <textarea name="message" colums="50" rows="10"></textarea>
  <br />
  <input type="submit" name="submit" value="Send Message"/>
</form>
</body>
</html>
[/code]
And in the processing script:
[code]<?php
  $email = $_POST['email'];
  $name = $_POST['name'];
  $message = stripslashes($_POST['message']);

  mail( "dleflair@bellsouth.net", "Link Request",
    $message, "From: $email" );
  header( "Location: http://www.example.com/thankyou.html");
?>[/code]
Note: the header() function is not a address tag, so it doesn't take any of the <a> options.

Ken
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.