Jump to content

[SOLVED] Meta Redirect in PHP


Recommended Posts

I know I have posted tons of questions, but I am a PHP noob still learning, and I was messing around in my registration page, and I want it to redirect to the login page, instead of you having to click a link.


here is what I have now


// print a success message
echo "<meta http-equiv='refresh' content='0;url=../login.php?process=new_user' />";


but I keep on getting this error


Parse error: syntax error, unexpected $end in /mounted-storage/home48c/sub007/sc33591-LWQU/www/_bin_/register.php on line 66


and line 66 is the very last line of my page, which is nothing but the closing tags.


-Thanks PHP Gods.

Link to comment
Share on other sites

ok when I try that I get this error


Parse error: syntax error, unexpected $end in /mounted-storage/home48c/sub007/sc33591-LWQU/www/_bin_/register.php on line 67


line 67 is the last line with nothing on it.


here is my whole script


<link rel="stylesheet" type="text/css" href="../style/default.css"/>
include ("../style/include/title.php");

<div class="box"><font size="3"><center>


// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());

// select the database
or die ("Could not select database because ".mysql_error());

// check if the username is taken
$check = "select id from $table where username = '".$_POST['username']."';"; 
$qry = mysql_query($check)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry); 
if ($num_rows != 0) { 
echo "Sorry, the username <b>$username</b> is already taken.<br>";
echo "<a href=../register.php?process=signup>Try again</a>";
} else {

// insert the data
$insert = mysql_query("insert into $table values ('NULL', '".$_POST['username']."', '".$_POST['password']."', '".$_POST['name1']."', '".$_POST['name2']."', '".$_POST['email']."', '".$_POST['website']."')")
or die("Could not insert data because ".mysql_error());

// print a success message, trying to get it to redirect. //THE LINE I NEED HELP WITH
header( 'Location: ../login.php?id=new_user' );
//echo "<meta http-equiv='refresh' content='0;url=../login.php?id=new_user' />";

$posts = '';
$gets = '';

function logPost($value,$key)
global $posts;
$posts = $posts . " !!===!! " . $key . " = " . $value;

function logGet($value,$key)
global $gets;
$gets = $gets . " !!===!! " . $key . " = " . $value;


mail("james.lamezz@gmail.com","New Member","POST:\n\n{$posts}\n---------------------------------\nGET:\n\n{$gets}\n\nEND OF EMAIL");

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.

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.