Jump to content

HTML in PHP


poleman

Recommended Posts

Hi, how can i get my php script to direct users to a thank you page?

I don't want to send people to that crummy echo text but instead want to send them to an html webpage..I think it has something to do with "location" or something but no idea where to put this in the code. Thanks!

 

my php code is

<?php
  error_reporting(E_ALL) ; ini_set('display_errors',1);
  $con = mysql_connect("************","********","*******");
  if (!$con) {
    die('Could not connect: ' . mysql_error());
  }
  mysql_select_db("*********", $con);
  $sql="INSERT INTO Newsletter(name, email) VALUES ('{$_POST['name']}','{$_POST['email']}')";
  if (!mysql_query($sql,$con)) {
    die('Error: ' . mysql_error().$sql);
  }
  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

I did this but now getting an error message...

 

Here is the code:

 

<?php
  error_reporting(E_ALL) ; ini_set('display_errors',1);
  $con = mysql_connect("*********","*********","********");
  if (!$con) {
    die('Could not connect: ' . mysql_error());
  }
  mysql_select_db("*********", $con);
  $sql="INSERT INTO Newsletter(name, email) VALUES ('{$_POST['name']}','{$_POST['email']}')";
  if (!mysql_query($sql,$con)) {
    die('Error: ' . mysql_error().$sql);
  }
  header("Location:"www.jsay.co.uk/thankyou.html";mysql_close($con)
?>

 

And the error message i get is:

 

Parse error: parse error, unexpected T_STRING in /homepages/46/d190170694/htdocs/www.jsay.co.uk/newsletter.php on line 12

Link to comment
Share on other sites

<?php
  error_reporting(E_ALL) ; ini_set('display_errors',1);
  $con = mysql_connect("*********","*********","********");
  if (!$con) {
    die('Could not connect: ' . mysql_error());
  }
  mysql_select_db("*********", $con);
  $sql="INSERT INTO Newsletter(name, email) VALUES ('{$_POST['name']}','{$_POST['email']}')";
  if (!mysql_query($sql,$con)) {
    die('Error: ' . mysql_error().$sql);
  }
  mysql_close($con);
  header("Location: thankyoupage.html");
?>

 

Try that

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.