Re: passing hidden values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You may use the following code. The code is not an inteligent solution to your problem I guess but it had always worked for me. You can use cURL's post options as well. The other way is to use AJAX posting method of course.

CODE:
<form name="DuplicateUserForm" action="duplicateuser.php" method="post">
<input type="hidden" name="duplicateuser" value="<?php echo $username; ?>">
</form>

<form name="ThankYouForm" action="thankyou.php" method="post">
 <input type="hidden" name="fname" value="<?php echo $fname; ?>">
 </form>
 
<?php
    if($usernamerows > 0)
          {
?>
<script language="Javascript">
document.DuplicateUserForm.submit();
</script>
  <?php
           }
           else
           {
?>
<script language="Javascript">
document.ThankYouForm.submit();
</script>
<?php

           }
?>

That's it. Then you can use either $_POST[] or $_REQUEST[] in either thankyou.php or duplicateuser.php.

Gratz...
Bedri


Sudhakar <finals27@xxxxxxxxx> wrote:                               i have an if else situation wherein if a user registers with a name 
 that is already available in the database i redirect them to 
 duplicateuser.php or else redirect to thankyou.php
 
 presently i am able to pass value of a variable $username as part of 
 the url and i am able to read using GET by doing so the value 
 appears in the browser address bar and i would like to use hidden 
 and also be able to read this value 
 
 following is the code i am presently using
 
    if($usernamerows > 0)
          { 
 header("Location: duplicateuser.php? duplicateuser=".$username); 
  
           }
           else
           {
 header("Location: thankyou.php?fname=".$fname);  
           } 
 
 how can i use hidden so that the url does not get appended in the 
 address bar and still the read the value of the variables i want to 
 pass and how should i read the variables in the other pages, is it 
 $_POST[]
 
 i tried using this code just before the header() statement but it 
 does not work and i get an error.
 
 echo "<input type ='hidden' name='duplicateuser' value='$username'>";
 echo "<input type ='hidden' name='fname' value='$fname'>";
 
 please advice.
 
 thanks.
 
 
     
                               

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux