473,405 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to check variable posted in the same page

i have code below i want use $user and $password which LoginId and password in the html code please hel me
<?php
session_start();
require_once('DB.php');
function validate() {
$user = $_POST['LoginID'];
echo "$user <br>";
$password = $_POST['Password'];
echo "$password <br>";
$dbcon = new DB();
$result = $dbcon -> Check($user,$password);
if($relult){
$_SESSION['error'] = 0;
return "AddProduct.php";
}
else{
$_SESSION['error'] = 1;
return "LoginPage.php";
}
}

?>

<html>
<head>
<title>Login Page</title>
</head>
<body>
<?php
if(!empty($_SESSION)){
if($_SESSION['error'] == 1){
echo "please enter correct Login ID and Password";
}
}
?>
<table border ="1">
<form action="<?php $string = validate(); print $string ;?>" method="post">
<tr>
<td>Login ID </td>
<td><input type="text" name="LoginID" size="30"/></td>
</tr>
<tr>
<td>Password </td>
<td><input type="password" name="Password" size="30"/></td>
</tr>
<tr colspan="2">
<td><input type="submit" value="Login"/></td>
</tr>
</form>
</table>

</body>
</html>
Apr 23 '07 #1
3 1572
Motoma
3,237 Expert 2GB
Please Read the Posting Guidelines and include the error messages you receive.
The LEAST you could do IF YOU WANT OUR HELP is to tell us WHAT IS GOING WRONG.
Apr 23 '07 #2
Please Read the Posting Guidelines and include the error messages you receive.
The LEAST you could do IF YOU WANT OUR HELP is to tell us WHAT IS GOING WRONG.
sorry for that
in above code when i try access the variables posted i.e. LOGINID AND PASSWORD i can't access them
what i am thinking they are not getting posted
Apr 24 '07 #3
code green
1,726 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. i can't access them
What do you mean you can't access them? Read Motoma's post again
Apr 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Shelly | last post by:
I set a session variable on error in the login page and then call the login page again. I test on that session variable but it shows as not set. I checked with an echo immediately after setting the...
8
by: Tammy B. | last post by:
Hiya - Big puzzler for me. Code Below I create a class. I save it to a session variable. Then, I retrieve the session variable back into a new local variable. I am able to use a method which...
15
by: David | last post by:
On a page optimised for IE, I'd like to check if the browser type is other than IE, so I can direct them to another page. How can I modify the code below to redirect to indextext.asp if they...
8
by: hb | last post by:
Hi, I need to declare a variable who's value can be preserve through the same ASP.Net page. I tried the following code, only the static variable s2 keeps its value=22 after lnk1_Click followed...
2
by: summer00 | last post by:
Hi everyone, I found that the value of a variable(string type for example) is lost after the aspx page postback. E.G: private void Page_Load(object sender, System.EventArgs e) {
9
by: Shapper | last post by:
Hello, I am declaring a variable in my aspx.vb code as follows: Public Class catalogue Public productid As String Private Sub Page_Load ... I have an image button where I call the...
10
by: Mark A. Sam | last post by:
Hello, I am using Visual Web Developer and decared a Public Variable in the Class section. I assigned a value in the load section, and on a button I set it up to increment, but it always...
4
by: Arpan | last post by:
The following code works fine: <script runat="server"> Dim strName As String = "Arpan" Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) Page.DataBind() End Sub </script> <form...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.