SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Member ngaisteve1's Avatar
    Join Date
    May 2003
    Location
    Kuala Lumpur, Malaysia (Boleh!)
    Posts
    264
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't pass variable

    I just start to play around with php few days ago. I managed to try some samples like passing variables (from a form page to a process page) and it works. But don't know why when I tried again just now, it didn't work. It manage to direct to the process page but can't see the variable I submited in form page. What is the possible problem here? Thanks.

  2. #2
    Member ngaisteve1's Avatar
    Join Date
    May 2003
    Location
    Kuala Lumpur, Malaysia (Boleh!)
    Posts
    264
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the form page:

    <html>
    <body>
    <form action="pass_var.php" method="POST">
    Your first name <input type="text" name="name">
    Your favorite color <input type="text" name="color">
    <input type="submit" value="Send Info">
    </form>
    </body>
    </html>

    Below is the process page:
    <html>
    <body>
    Hello <?php print $_POST["name"]; ?>,
    Your favorite color is <?php print $_POST["color"]; ?>.
    </body>
    </html>

  3. #3
    SitePoint Guru
    Join Date
    Sep 2001
    Location
    Vancouver
    Posts
    809
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this instead:
    PHP Code:
    <? echo $name?>


Bookmarks

Posting Permissions

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