943,169 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 115
  • PHP RSS
Aug 30th, 2010
0

PHP/MySQL Mailing List problem

Expand Post »
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
PHP Syntax (Toggle Plain Text)
  1. <form action="mail.php" method="post">
  2. Email: <input type="text" name="email" />
  3. <input type="submit" />
  4. </form>

PHP
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. include 'auth.php';
  3. if (!$con)
  4. {
  5. die('Could not connect: ' . mysql_error());
  6. }
  7.  
  8. @mysql_select_db(test) or die( "Unable to select database");
  9.  
  10. $sql="INSERT INTO mail (email)
  11. VALUES
  12. ('$_POST[email]')";
  13.  
  14. if (!mysql_query($sql,$con))
  15. {
  16. die('Error: ' . mysql_error());
  17. }
  18. echo "1 record added";
  19.  
  20. mysql_close($con)
  21. ?>

It's probably something simple i'm overlooking, but all help is appreciated!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
buzz-lightyear is offline Offline
6 posts
since Aug 2010
Aug 31st, 2010
0
Re: PHP/MySQL Mailing List problem
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.
Reputation Points: 11
Solved Threads: 5
Light Poster
EverWebby is offline Offline
46 posts
since Jan 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: problem in checking account balances
Next Thread in PHP Forum Timeline: problem getting google analytics into php





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC