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)

?>

 

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

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.