Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 13 of 13
  1. #1
    Join Date
    Jul 2004
    Posts
    313

    asp or php passing variables? not related to AMS but you guys always seem to know :ye

    Hi guys,

    I am trying to pass variables through my pages it can be asp or php, I have managed to pass "fname" to the next page but I would like page2 which retrieves this information to store it in a hidden field so that I can pass it to another page, any ideas on how to do this?

    Thanks guys
    Last edited by ianhull; 06-10-2005 at 04:21 AM. Reason: Spelling mistakes

  2. #2
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    If it's in a form, that's easy. So for example our original link which leads from page 1 to page 2 might be:

    http://www.yoursite.com/page1.php?name=Joe

    Then on page 2 you simply add this to your HTML form:

    <input type="hidden" name="name" value="<?php echo $name; ?>">


  3. #3
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695
    Just off the cuff, I think a 'global function' should be able to handle that.

  4. #4
    Join Date
    Jul 2004
    Posts
    313
    Excellent Corey, Once agin you are the man!

    And thanks for that Rhosk, I will look into that.

    Thanks again guys.

  5. #5
    Join Date
    Aug 2003
    Location
    Maine, USA
    Posts
    1,695
    Once again, Corey is quick on the fly. He mentioned that you were "talking web pages". That's what I get for reading/replying too quick. I was thinking too deep. Need more java I guess.

  6. #6
    Join Date
    Jul 2004
    Posts
    313
    Hi again,

    I seem to be having a little trouble with this one.

    I can post to the first page which is called welcome.php but I cannot seem to post to welcome2.php as I have an error on line 5

    I cannot seem to work it out.

    <html>
    <body>Welcome <?php echo $_POST["name"]; ?>.<br />
    </body>
    <form action="welcome2.php" method="POST">
    <input type="hidden" name="name" value="<?php echo $name; ?>">
    <input type="submit" />
    </form>

    </html>

    Any more help will be greatly appreciated.

    Thanks

  7. #7
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Hi. In that case just use:

    <input type="hidden" name="name" value="<?php echo $_POST["name"]; ?>">


  8. #8
    Join Date
    Jul 2004
    Posts
    313


    Excellent Corey.

    Thanks again.

  9. #9
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Glad to help.

  10. #10
    Join Date
    Jul 2004
    Posts
    313
    Hi again guys,

    I just have a little question about php and storing everything globally

    I have used a include function on evey page and I am wondering if I enter my name and then retrieve it on page 3, then on page 4 if I have another input box which uses the var name "name" again wil it overwrite the stored var?

    Thanks guys, and Ron thanks for your suggestion on globals it does keep everything nice and tidy and it is easier to learn with.

  11. #11
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Yes it will, you can only use each variable name once if you wish the value to hold, or at least you would have to shift the value to another variable/array if you want to keep it but re-use the variable name.

    It's the same as in AMS if you replace a variable value, the first one is lost, i.e.:

    name = "Joe";
    name = "Bob";

    Will result in the variable called "name" containing the value "Bob". "Joe" is lost forever unless you shift it somewhere else, i.e.

    names={};
    name = "Joe";
    names[1] = name;
    name = "Bob";
    names[2] = name;

    Would result in the variable "name" containing the value "Bob" but the table "names" containing both "Joe" and "Bob"... Hope that helps.

  12. #12
    Join Date
    Jul 2004
    Posts
    313
    Hey that's excellent Corey,

    I did not know I could do that with the tables, You just saved me loads of time again.

    Thank you very much


  13. #13
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    No problem, for even more check out the free video on "Tables Made Easy" at:

    http://www.speedytraining.com/site/cd3.php


Similar Threads

  1. Help passing screen variables
    By swilk in forum Setup Factory 7.0
    Replies: 2
    Last Post: 12-06-2004, 11:07 AM

Posting Permissions

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