hmmm. i dont understand ...
Printable View
hmmm. i dont understand ...
If you load a page: http://example.com?var=value
Then on THAT page, $_GET['var'] will be "value".
But then if you AFTER THAT load another page with javascript, you cannot access the data from the first load.
If you use a function "load" to make part of the page load:
load('otherpage.php');
Then it will load the same page like if you typed "otherpage.php" into the address bar.
If you did:
load('otherpage.php?var=value');
Only then, $_GET['var'] will be "value" in the included page.
When you use ajax or another method like that, it is the same as loading the page a different time than the first load-- the same variables will not be available.
Based on this and the other questions you have posted, I think you might be trying to do more than is possible with ajax, so you might want to use iframes instead. That would be easier to control and more reliable.
hmm... yes .. ! but i changed
before :
{
<a href="" onclick=calls javascript>
javascript replaces addressbar text to address#page
}
now : {
<a href=#page onclick=javascript
javascript loads ajax page
}
then too not working .. !
i tried with setting cookies ... ! then it worked in the way i expected .. !
but when i goto validate.php it is not returning back to original page "index.php#members"
used header("Location: index.php#members");
im able to get what i need using cookies ... it works fine .. but have a little problem deleting the cookies
here is the code
members.php :
validation.php :PHP Code:<?php
if(isset($_COOKIE['prodigyValidationResult']))
{
$username = $_COOKIE['prodigyValidationResult'];
$r = true;
}
else
{
$r = false;
}
?>
<?php
if($r){
echo "Welcome " . $username;
}else{
echo "Login";
}
?>
</h3>
<?php
if($r){
echo "<br />Login correct";
echo '
<a href="javascript:document.logout.submit()">Logout</a>
<form action="validate.php" method="post" name="logout">
<input type="hidden" name="log" value="1" />
</form>
';
}else{
echo '<form name="login_form" action="validate.php" method="post">
<table border=0 cellpadding=1 cellspacing=8>
<tr>
<td>User name </td>
<td><input type="text" class="box" name="userid" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" class="box" name="passwd" /></td>
</tr>
<tr>
<td></td>
<td>
<input type="hidden" name="log" value="0" />
<input type="submit" />
</td>
</tr>
</table>
</form>';
}
?>
PHP Code:<?php
$cookie = "prodigyValidationResult";
if($_POST['log'] == "0")
{
if($_POST['userid'] == "boopathirajaa" )
{
if($_POST['passwd'] == "admin" )
{
if(isset($_COOKIE[$cookie]) == false)
{
setcookie($cookie,$_POST['userid'],time()+3600,'/');
echo "Login done";
}
else
{
echo "Already logged in as " . $_COOKIE[$cookie] . ". Logging in as " . $_POST['userid'] . "?<br>";
setcookie($cookie,'',time()-3600);
setcookie($cookie,$_POST['userid'],time() + 3600,'/');
echo "Login done";
}
}
}
}
else if($_POST['log'] == "1")
{
echo "Logging out <br />";
echo setcookie($cookie,"",1);
}
?>
<a href="index.php#members" onclick="document.validation.submit();">Click here to go back</a>
im not able to delete the cookie i set using
Code:setcookie($cookie,' ',1 OR time()-3600);