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
https://forums.phpfreaks.com/topic/92893-link-back-to-indexphp/
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
https://forums.phpfreaks.com/topic/92893-link-back-to-indexphp/#findComment-475871
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.