Hi EveryBody,
well i have some problem with the hidden variable....
the problem is
in one page i am inserting the details into database...on successfull insertion i am striring a message in varaiable like
$confirm="Information successfully Added";
so i am redirecting to another page using
<html>
<body onload="redirect.submit">
<form name="redirect" action="page2.php" method="post">
<input type="hidden" name="confirm" value="<? echo $confirm";?>>
</form>
</body>
</html>
so when i chk the variable $confirm in page2.php
and print the value only word "Information" is displayed ...
can anyone tell whats the problem
any alternate method...........
Problem with hidden variable
Moderator: General Moderators
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
In general when posting please provide as much consise information as possible.
I would guess that you need to look up http://www.php.net/urlencode when creating the parameter. If you are using sessions I would store the variable in a session.
Unless you have register globals on in php (not default and not recommended) you need to get the variable using $_POST['confirm'] rather than just $confirm.
I would guess that you need to look up http://www.php.net/urlencode when creating the parameter. If you are using sessions I would store the variable in a session.
Unless you have register globals on in php (not default and not recommended) you need to get the variable using $_POST['confirm'] rather than just $confirm.
-
Black Unicorn
- Forum Commoner
- Posts: 48
- Joined: Mon Jun 16, 2003 9:19 am
- Location: United Kingdom
There are 2 obvious problems. First,
Needs to be
and your hidden variable needs to be
It has already been said, better to provide too much contextual info rather than too little.
Regards,
H
Code: Select all
<body onload = "redirect.submit">Code: Select all
<body onload = "redirect.submit()">Code: Select all
<input type="hidden" name="confirm" value="<?=$confirm ?>" />Regards,
H
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Black Unicorn wrote:There are 2 obvious problems. First,
Code: Select all
<input type="hidden" name="confirm" value="<?=$confirm ?>" />
Not every server has shorttags enabled, and it is not a requirement to use them. It's always better to be safe