SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sending $_GET variable with $_SERVER['PHP_SELF']

    Hi

    I have a form having following clause.

    method = "POST" action="<?php echo $_SERVER['PHP_SELF'] ;?>"

    So u can see that the POST method is used. But i want to send some $_GET variable also. Please let me know how can i do this....

    can i do it like this way ???

    <?php echo $_SERVER['PHP_SELF']?userid={$userid}&bookid={$bookid} ;?>

    plz help....

  2. #2
    SitePoint Member hacki's Avatar
    Join Date
    Feb 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can i do it like this way ???

    <?php echo $_SERVER['PHP_SELF']?userid={$userid}&bookid={$bookid} ;?>
    sure

  3. #3
    SitePoint Member tpra21's Avatar
    Join Date
    Feb 2006
    Location
    Columbus, Ohio
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <tr><td colspan="2" align="center">
    <input type="hidden" name="c" value="<?=$a?>"/>
    <input type="submit" name="update" value="UPDATE">
    <input type="reset" name="clear" value="CLEAR FORM">
    </td></tr></table>
    </form>
    Use a hidden field to pass the variable. Then, when you want to access it after the post (form submission), just use the

    PHP Code:
    $a $_POST['c']; 
    I use this with forms and the GET (like you mention) for passing variables in links.
    http://www.landlorddocuments.com
    More than 70 free real estate forms available.


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
  •