SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict itsource's Avatar
    Join Date
    Jun 2001
    Location
    Thailand
    Posts
    369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    keep variable from link

    My code has following
    PHP Code:
    info.php
    <a href="info.php?group=1">1</a>
    <
    a href="info.php?group=2">2</a>
    <
    a href="info.php?group=3">3</a>



    $sql select something where id='$group';
    display result;
    <
    input type=submit"> 
    From my code, if user call this page, it don't display anything but when user click each link it has send $group to script
    and query data from database depend on $group and display result.

    If I click link2 it has $group=2 and I want this variable still exist when I click submit. Althought I click submit many time the
    $group=2 still exist? How shoudl I do?

    (I click link 1 time and following click submit many time and want $group=2 still exist)

    Thanks for comment.
    I live in Thailand. My English grammar not well.

  2. #2
    will code HTML for food Michel V's Avatar
    Join Date
    Sep 2000
    Location
    Corsica
    Posts
    552
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    :???: Let's see...

    If you want the variable $group to be kept when you send another form, just add this in your form:
    Code:
    <input type="hidden" name="group" value="<?php echo $group; ?>" />
    If that's what you were asking

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yea, if you want to keep group2 in there, you'll have to submit it as a hidden field each time you have a new form.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  4. #4
    SitePoint Addict itsource's Avatar
    Join Date
    Jun 2001
    Location
    Thailand
    Posts
    369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much
    I live in Thailand. My English grammar not well.


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
  •