Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2003
    Location
    London, UK
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting a variable using a text box

    Hi, this could possibly be an obvious question, but I've just started learning PHP, so, yeah give me a chance :P.

    What i would like to do is for the user to define what a variable should equal by typing it into a textbox.

    eg.

    If the user typed mobile phone into the textbox...
    $variable="mobilephone";

    or if the user type internet into the textbox...
    $variable="internet";

    You get the idea

    Thanks in advance

    JayV

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Once the form has been submitted by the POST method, you can use:

    PHP Code:
    <?php
    $variable 
    $_POST['textareanamehere'];
    ?>


  •  

    Posting Permissions

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