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
https://forums.phpfreaks.com/topic/38938-html-in-php/
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
https://forums.phpfreaks.com/topic/38938-html-in-php/#findComment-187308
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
https://forums.phpfreaks.com/topic/38938-html-in-php/#findComment-187314
Share on other sites

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.