0

Hey guys,

I'm a total newbie with this PHP stuff but i'm stuck with my page that allows people to sign up to my mailing list. Every time you press the "Submit Query" button on the form it brings up the option to download the php file. Have been working on it for a while and can't figure it out, its really starting to bug me!

Anyway, here is the code, if you need any more info let me know:

HTML

<form action="mail.php" method="post">
Email: <input type="text" name="email" /> 
<input type="submit" />
</form>

PHP

<?php
include 'auth.php';
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

@mysql_select_db(test) or die( "Unable to select database");

$sql="INSERT INTO mail (email)
VALUES 
('$_POST[email]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con)
?>

It's probably something simple i'm overlooking, but all help is appreciated!

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by EverWebby
0

First off, you need to validate the user form contents. I have experienced the file forcing a download on xampp and mamp. My solution came to me when I checked the error log files. This might be a great place to start looking.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.