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
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
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
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
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.

Guest
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.