Jump to content

Php redirect


cool_techie

Recommended Posts

Sir,i used the following code for trial purpose to see if i suceed..........

But it is showing no effect....no errors r being generated but no output is being given....it renders a blank page..

 

<?php

 

$dbConnect = mysql_pconnect("localhost", "root") or die("Cannot connect database");

mysql_select_db("ABC") or die("Cannot select database");

 

 

$user = $_GET['uname'];

$passwd = $_GET['passwd'];

 

if (isset($_GET['submit']))

{

    $query = "select `fname`, `password` FROM details  WHERE `fname`='$user' AND `password`='$passwd'";

 

    $result=mysql_query($query);

    if(mysql_num_rows($result) == 1)

    {

        header('Location:C:\xampp\htdocs\ABCcinemas\index1.html\');

    }

    else

    {

        echo "No match found !<hr />";

    }

}

 

 

 

?>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/217939-php-redirect/#findComment-1131121
Share on other sites

please post it in the php brackets next time ;)

<?php
   
$dbConnect = mysql_pconnect("localhost", "root") or die("Cannot connect database");
mysql_select_db("ABC") or die("Cannot select database");


$user = $_GET['uname'];
$passwd = $_GET['passwd'];

if (isset($_GET['submit']))
{
    $query = "select `fname`, `password` FROM details   WHERE `fname`='$user' AND `password`='$passwd'";

    $result=mysql_query($query);
    if(mysql_num_rows($result) == 1)
    {
        header('Location:C:\xampp\htdocs\ABCcinemas\index1.html\');
    }
    else
    {
        echo "No match found !<hr />";
    }
}



?>

 

what exactly is happening when this code is executed nothing?

 

Link to comment
https://forums.phpfreaks.com/topic/217939-php-redirect/#findComment-1131130
Share on other sites

$_GET gathers information from the browser, with tue $_GET['submit'] this makes me think that you are using a form probably in the form of a login form.

 

So in that case you'd change all your $_GET to $_POST

 

if it truely is a GET you are using, make sure you echo it out like:

 

<?php

echo "<pre>";
print_r($_GET);
echo "</pre>";

?>

 

that'll help you to see what values you do have in an array, it also outputs it in an easy to read fashion so you can help to debug your solution.  Although my money is on changing $_GET to $_POST

Link to comment
https://forums.phpfreaks.com/topic/217939-php-redirect/#findComment-1131134
Share on other sites

hello,

      Sir now i am using the following code...but the redirected page is completely blank....

My code is:

 

 

<?php

{

$dbConnect = mysql_pconnect("localhost", "root") or die("Cannot connect database");

mysql_select_db("ABC") or die("Cannot select database");

 

 

$user = $_POST['uname'];

$passwd = $_POST['passwd'];

 

if (isset($_POST['submit']))

{

    $query = "select `fname`, `password` FROM details  WHERE `fname`='$user' AND `password`='$passwd'";

 

    $result=mysql_query($query);

    if(mysql_num_rows($result) == 1)

    {

        header('Location:C:\xampp\htdocs\ABCcinemas\index1.html');

    }

    else

    {

        echo "No match found !<hr />";

    }

}

}

 

?>

 

 

sir please help me out with...it...

Link to comment
https://forums.phpfreaks.com/topic/217939-php-redirect/#findComment-1131339
Share on other sites

yes sir,i am using it on xampp via http://localhost

and my form is on index.html.....which uses php script login.php

now when i tried header("location:index1.html")

there was no effect............the redirected page is blank.....and in address bar contains address of login.php

Link to comment
https://forums.phpfreaks.com/topic/217939-php-redirect/#findComment-1131368
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.