Jump to content

Link back to index.php


barry6628

Recommended Posts

Hi

 

This will be easy for you ? I have a validation form after input from the customer 

$affected_rows = mysql_num_rows($result);

 

 

 

if($affected_rows == 1){

 

print 'Validated';

}

else {

print 'Not Validated';

}

 

Instead of printing Validate I want the code to go directly back to the index.php

How do I do it.

 

Regards, and thanks Barry

 

Link to comment
Share on other sites

Sorry yet again Ill let you have all the page.

 

<?php

session_start();

?>

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

<body>

 

 

<?php

$check_name = $_POST['userName'];

$check_password = $_POST['password'];

echo "$check_name";

echo "$check_password";

mysql_connect("xxxxxxxxxxxx","xxxxxxxxxxxx","xxxxxxxxx") or die("Could not connect to MySQL server!");

 

 

mysql_select_db("xxx") or die("Could not select database!");

echo "selected db"or die("Could not select database!");

$result = mysql_query("SELECT * FROM accounts WHERE fname = '$check_name' AND password = '$check_password' ")

or die(mysql_error()); 

$affected_rows = mysql_num_rows($result);

 

if($affected_rows == 1){

     

header("Location: index.php");

        }

      else {

        print 'Not Validated';

        }

 

/*if($affected_rows == 1){

 

print 'Validated';

}

else {

print 'Not Validated';

}

*/

 

?>

</body>

</html>

 

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.