Results 1 to 18 of 18

Thread: form actions

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    I'm mobile
    Posts
    166

    form actions

    hi!

    need some professional help, so I turn to you guys and girls!

    1) instead of using action="something.php" can I instead write a php-code on the spot? tried but failed....


    thanks!
    [p r a e t o r i a n]

  2. #2
    scoutt
    Guest
    if you are using a form tag you have to have the action set to something or the browser will not know what to do. and what do you mean write php code on the spot

  3. #3
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    i think he means:
    <form method="post" action="<? echo "$PHP_SELF";?>">
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I thought he meant actually putting code in there:

    Code:
    <form action=" <?php echo $_REQUEST['num'] + 1; ?>">
    In that case, no.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by cpradio
    i think he means:
    <form method="post" action="<? echo "$PHP_SELF";?>">
    *cough cough* $_SERVER['PHP_SELF']; *ahem*
    My evil laugh has a squeak in it.

    kristopherwilson.com

  6. #6
    scoutt
    Guest
    hehe good catch, I'm slipping, but also if that is what he meant.

  7. #7
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Originally posted by The Hobo


    *cough cough* $_SERVER['PHP_SELF']; *ahem*
    What a suck up Nonetheless, it works if you use ini_set("register_globals",1); at the top of your code.
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  8. #8
    Fanatic Member twanvl's Avatar
    Join Date
    Dec 2001
    Posts
    771
    By the way:
    Is there a reason to use action="<?php echo $_SERVER['PHP_SELF']; ?>" instead of action="#" ?

  9. #9
    scoutt
    Guest
    ahem hobo.... $_SERVER['SCRIPT_NAME']; that is the preferred way. just like that no changing it to the actuall script name.

    and twanvl, # is not preferred either.

  10. #10
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by cpradio


    What a suck up Nonetheless, it works if you use ini_set("register_globals",1); at the top of your code.
    I think there's a reason they shut it off, buddy. But go ahead...play God. As if it's hard to type a few extra characters anyways.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  11. #11
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by scoutt
    ahem hobo.... $_SERVER['SCRIPT_NAME']; that is the preferred way. just like that no changing it to the actuall script name.

    and twanvl, # is not preferred either.
    Some people prefer petite chicks. Some like the butts round and delicious. Some like the little melons, other's indulge themselves in watermelons. A matter of preference doesn't not pertain to the general public but to the individual.

    But okay, I'm wrong
    My evil laugh has a squeak in it.

    kristopherwilson.com

  12. #12
    scoutt
    Guest
    lol

    where is [praetorian] in all this??

  13. #13
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Originally posted by The Hobo


    I think there's a reason they shut it off, buddy. But go ahead...play God. As if it's hard to type a few extra characters anyways.
    lol, i know. I am just giving you a hard time b/c I keep forgetting about them shutting it off.
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  14. #14
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Geez...next you'll be running around cloning things.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  15. #15
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    Hey! no one is supposed to know that I am experimenting with cloning.
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  16. #16

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    I'm mobile
    Posts
    166
    so you can't write <form action=" <?php echo $_REQUEST['num'] + 1; ?>"> ?!

    scoutt: haven't answered earlier because I've been asleep, got a nasy hang over.......nah, just kidding.....
    [p r a e t o r i a n]

  17. #17
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    No you can't. because then that's going to be read as:

    <form action="1">

    or if you have a value already set for num, it'll have that value + 1 in there. All this will happen as the page is being sent to the browser. So no, it won't work.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  18. #18
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    You can do the following though:
    PHP Code:
    <form method="post" action="<?php echo$_SERVER['SCRIPT_NAME']."?num=".$_REQUEST['num'] + 1?>">
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

Posting Permissions

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



Click Here to Expand Forum to Full Width