Jump to content

Recommended Posts

>:(

 

Hi, look I'll just admit it, I'm a rookie, and I can't get this script to work. I think it has somthing to do with the form method line, or something, anyways I have to have this up this afternoon and I need some help from someone who has some patience.

 

The code is pasted below and what is supposed to do is take an email address from a field, validate it, send a reply and then submit it to a database. Please, can someone help?

 

[code]<html><head><title>Email Submission Page</title></head>
<body>
      <form method="post"
            action=testemailscript.php>
            Please enter a valid email address
            <input type="text"
             name="email"
             value="">
      <input type="submit"
             name="submit"
             value="submit"
      </form>
<?
@$email = addslashes($_POST['email']);

// Validation
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
die("<p align='center'><font face='Arial' size='3' color='#FFFFFF'>That email address is invalid</font></p>");
}

if (strlen($email) == 0 )
{
die("<p align=\"center\"><font face=\"Vrinda\" size=\"4\"color=\"#FFFFFF\">Please enter your email address</font></p>");
}

$pfw_header = "From: **************";
$pfw_subject = "Comfirmation";
$pfw_email_to = "$email";
$pfw_message = "Email Confirmation";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '*********';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die
('Error connecting to mysql');

$dbname = 'testemail';
mysql_select_db($dbname);

$sql = "insert into email (email_address) values('$email')";
mysql_close($conn);
?>
</body></html>

[/code]

I'm not getting any errors, when i goto the site and submit an email address, I don't get a response and nothing goes to the db, the page is www.contract2print.com/testemailscript.php if you want to see, it just won't work at all for me

 

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.