Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 9 of 9

Thread: Using hidden input type to send php data in the request problem.

  1. #1

    Using hidden input type to send php data in the request problem.

    I have this code in a file called saveClientUtility.php:

    HTML Code:
    <a href="retrieveClientUtility.php">Retrieve</a>
    followed by
    PHP Code:
    <input name="userRet" type="hidden" value="<?php echo ($user); ?>" />
    My problem is when I click on the Retrieve link, the userRet value is not
    getting passed in the request to retrieveClientUtility.php. I have viewed the source of saveClientUtility.php and the value for
    userRet is showing up so I know that value is okay.

    It's when I get to the retrieveClientUtility.php and do a $_POST['userRet'] that I don't see any value. I've also tried using $_REQUEST['userRet'], $_GET['userRet'] and these have no data as well.

    Any help would be appreciated.

    Thanks
    ---------------------------------------
    FlashNewby
    "Not really a newby just thought the name was cool ...."

  2. #2
    4,029
    posts
    home cooking is killing the restaurant industry
    Why don't you just do this:

    PHP Code:
    <a href="retrieveClientUtility.php?userRet=<?php echo (urlencode ($user)); ?>">Retrieve</a>
    That should work
    There are only 10 kinds of people in this world:
    Those that might know ternary, those that do, and those that don't
    Say NO to DRM.

  3. #3
    I did try this and got it to work but was trying to keep the id out of the querystring. I'll use this and keep looking for another way.

    Thanks
    ---------------------------------------
    FlashNewby
    "Not really a newby just thought the name was cool ...."

  4. #4
    use this:
    HTML Code:
    <a href="retrieveClientUtility.php?u=<?php echo (str_rot13 ($user)); ?>">Retrieve</a> 
    in retrieveClientUtility.php use
    PHP Code:
    <?php

    $userid 
    str_rot13 ($_GET['u']);

    ?>

  5. #5
    or use sessions - it's even easier!

  6. #6
    Does str_rot13 do some encrypting or something?

    Ya know fluid_tw0 I thought about using sessions, and your right I will probably use sessions. It's cleaner as well.

    Thanks
    ---------------------------------------
    FlashNewby
    "Not really a newby just thought the name was cool ...."

  7. #7
    str_rot13 - encodes/decodes string

    sessions are the best solution here

  8. #8
    or you can make a form out of it... so you can acces the variable as post data.

    But sessions are good... you can also use it to acces the variable on other pages.

  9. #9
    Great, thanks guys!
    ---------------------------------------
    FlashNewby
    "Not really a newby just thought the name was cool ...."

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012