Jump to content

Email not being entered into SQL properly


poleman

Recommended Posts

here you go.... thanks :-)

 

 

<form method="POST" action="newsletterfinal.php">

                        Name:        <input type="text" name="name" size="20"><br>

                        Surname:   <input type="text" name="surname" size="20"><br>

                        City:          

                        <input type="text" name="city" size="20"><br>

                        Email         

                        <input type="text" name="email" size="30">           

                        <br>

           <br>

                 

                        <button name="B1">Subscribe</button><br>

                        <br>

            <br>

                       </p>

          </form>

 

<?php

$con = mysql_connect

("db778.oneandone.co.uk","dbo191523061","zcMcsqnB");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }mysql_select_db("db191523061", $con);$sql="INSERT INTO Newsletter(name,

surname, city, email)

VALUES

('$_POST[name]','$_POST[surname]','$_POST[city]','$_POST

')";if (!mysql_query

($sql,$con))

  {

  die('Error: ' . mysql_error());

  }

echo "Thank you for subscribing to the JSay Newsletter. We look forward to keeping you up to date with what's happening on JSay and in your community.";mysql_close($con)

?>

 

 

Thanks... I did that but still get the Array error in the database back end...

 

here is the new code...

<?php
$con = mysql_connect 
("db778.oneandone.co.uk","dbo191523061","zcMcsqnB");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }mysql_select_db("db191523061", $con);$sql="INSERT INTO Newsletter(name, 
surname, city, email)
VALUES
('$_POST[name]','$_POST[surname]','$_POST[city]','$_POST [email]')";if (!mysql_query 
($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Thank you for subscribing to the JSay Newsletter. We look forward to keeping you up to date with what's happening on JSay and in your community.";mysql_close($con)
?>

 

 

Thanks for your help...

 

thank you!!!  it works now  :)

 

Now, how can i can get it to redirect to a url page instead of having a white page with just that thank you message on it?

 

Would like it to redirect to www.jsay.co.uk/newsletter_thankyou

 

Any ideas?

 

thanks for all your help... this has been driving me nuts all night

 

 

No.

Do it exactly like artacus posted. No echo.

 

Any code after a redirection will not be run.

You also need to stop putting more than one statement per line, that's going to get confusing.

 

in this case it looks like header() will be the last line of code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.