im having two problems with my site, i wrote Javascript code into my page to return true if the data that was entered was correct else return false and im having two buttons to submit the data
EX:
this button to check for availability and the other to check that all data are correct to insert into it database in the same form.
EX:
The other problem, i want to login in the same page im already on and make the form disappear when i enter the correct data how to do that
EX:
If I understand, and forgive me if I don't, you want the login page to POST the form data back to itself and then display something different if the login was sucessful?
If this is the case I would have the login page first check $_POST data to see if the items have been set. If they have then check if they are correct. If they have not then display the form.
If the items are correct display what you want to display to users logged in otherwise show the form with some text explaining the error and offering help such as reminders.
Here's some psuedo code.
-
if (isset($_POST['user']) && isset($_POST['password']))
-
{
-
if(username=valid && password=valid) //psuedocode
-
{
-
$lnIsValid 0;
-
}
-
else
-
{
-
$lnIsValid = 2;
-
}
-
}
-
else // not set
-
{
-
$lnIsValid = 1;
-
}
-
-
switch($lnIsValid)
-
{
-
case 0:
-
echo "Welcome";
-
break;
-
case 1: // display form for the first time
-
include("form.php") ; // we can then use this later
-
break;
-
case 2:
-
include("form.php");
-
echo "the data entered did not match do you need assistance"; //offer password reminder etc
-
break;
-
}
-
This is just a quick peice of psuedo code, but hopefully it will point you in the right direction.
Don't forget, you can always post back if you need more help
Cheers
nathj