Page Redirect
Posted: Wed Nov 05, 2008 3:36 pm
I'm a novice at PHP, so be kind ...
I have an HTML page that captures a username/password and sends to a PHP page for processing. If all's well, the PHP sends the viewer to their desired page. Currently I'm using a javascript command for the page redirect, but when viewed on Mac using Firefox there's a 'jump' from the login page to the landing page. By jump I mean the page(s) actually shift side to side visually despite the table dimensions, etc of each page being identical. It's very distracting and unprofessional looking. I'm attempting, instead, to redirect using <?php header('Location:listing.html');?> but that's not working either. I've even tried calling the preceding as a function to no avail. Remember I'm a rookie so don't laugh, but here's the code I'm dabbling with ...
<?php
$pWord='password';
$uName='username';
$checkUName=$_POST['checkUName'];
$checkPWord=$_POST['checkPWord'];
$uNamePass=false;
$pWordPass=false;
echo "<p align='left' class='form'>Login<br>";
if($uName==$checkUName) {
$uNamePass=true;
echo "<input name='checkUName' type='text' id='loginfield' size='20' value='$uName' style='background-color:#ffffff'><br>";
} else {
echo "<input name='checkUName' type='text' id='loginfield' size='20' value='Incorrect Login.' onFocus='doClear(this)' style='background-color:#fdfcd4'><br>";
}
echo "Password<br>";
if($pWord==$checkPWord) {
$pWordPass=true;
echo "<input name='checkPWord' type='text' id='loginfield' size='20' value='$pWord' style='background-color:#ffffff'><br>";
} else {
echo "<input name='checkPWord' type='password' id='loginfield' size='20' onFocus='doClear(this)' style='background-color:#fdfcd4'><br><br>";
}
if($pWordPass && $uNamePass) {
echo "<script language='javascript'>window.location = 'listing.html'</script>";
/// ALTERNATELY I'VE TRIED ...
/// header('Location:listing.html');
}
?>
Anyone else run into this problem? Is it a javascript vs php redirect solution? Any assistance would be greatly appreciated. You can view the page live at http://www.cannedads.net/ShuklaSite/login.html. Username: username, Password: password.
Thanks in advance -
sleepydad
I have an HTML page that captures a username/password and sends to a PHP page for processing. If all's well, the PHP sends the viewer to their desired page. Currently I'm using a javascript command for the page redirect, but when viewed on Mac using Firefox there's a 'jump' from the login page to the landing page. By jump I mean the page(s) actually shift side to side visually despite the table dimensions, etc of each page being identical. It's very distracting and unprofessional looking. I'm attempting, instead, to redirect using <?php header('Location:listing.html');?> but that's not working either. I've even tried calling the preceding as a function to no avail. Remember I'm a rookie so don't laugh, but here's the code I'm dabbling with ...
<?php
$pWord='password';
$uName='username';
$checkUName=$_POST['checkUName'];
$checkPWord=$_POST['checkPWord'];
$uNamePass=false;
$pWordPass=false;
echo "<p align='left' class='form'>Login<br>";
if($uName==$checkUName) {
$uNamePass=true;
echo "<input name='checkUName' type='text' id='loginfield' size='20' value='$uName' style='background-color:#ffffff'><br>";
} else {
echo "<input name='checkUName' type='text' id='loginfield' size='20' value='Incorrect Login.' onFocus='doClear(this)' style='background-color:#fdfcd4'><br>";
}
echo "Password<br>";
if($pWord==$checkPWord) {
$pWordPass=true;
echo "<input name='checkPWord' type='text' id='loginfield' size='20' value='$pWord' style='background-color:#ffffff'><br>";
} else {
echo "<input name='checkPWord' type='password' id='loginfield' size='20' onFocus='doClear(this)' style='background-color:#fdfcd4'><br><br>";
}
if($pWordPass && $uNamePass) {
echo "<script language='javascript'>window.location = 'listing.html'</script>";
/// ALTERNATELY I'VE TRIED ...
/// header('Location:listing.html');
}
?>
Anyone else run into this problem? Is it a javascript vs php redirect solution? Any assistance would be greatly appreciated. You can view the page live at http://www.cannedads.net/ShuklaSite/login.html. Username: username, Password: password.
Thanks in advance -
sleepydad