using javascript and post?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shadow_blade47
Forum Newbie
Posts: 12
Joined: Fri Nov 07, 2003 3:41 am

using javascript and post?

Post by shadow_blade47 »

hi there. I've made a script that when it's success full it redirects the user to a success page. I'd like to display some information on that page such as username/e-mail and race and classes (its an mmorpg). Here is the code:

$query = "INSERT INTO user (user_id, user_name, first_name, last_name, password, email, remote_addr, date_created)
VALUES (NULL, '$User_name', '$First_name', '$Last_name', '$password', '$Email1', '$user_ip', NOW())";
$result = mysql_query($query);
if (!$result) {
$feedback = 'ERROR - MySQL has encountered a technical failure - contact the administrator,';
return $feedback;
} else {
echo "<script language=\"javascript\">";
echo "document.location='success.php'";
echo "</script>";

after the else part i was wondering what i should put to pass on information from this page to the next. The variables have already been set on this page but is there a way of carrying them through to the next page whilst still redirecting the browser using javascript? cheers
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

i dont believe so.. thats why i would've not even had a "success" page, and instead put whatever you wanted to say in your

Code: Select all

&#125; else &#123; 
echo "<script language="javascript">"; 
echo "document.location='success.php'"; 
echo "</script>";
part.. that way the variables would be there

you could always add session variables.. (either just their ID, and call the rest of the stuff on success.php using their ID, or all the variables)
Post Reply