SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: form problem

  1. #1
    SitePoint Enthusiast cyber247's Avatar
    Join Date
    Dec 2007
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    form problem

    hello everyone,

    i create a new html file and another php file here they are :

    Code HTML4Strict:
    <form action="welcome2.php" method="POST">
    <labe>firstname :<input type="text" name="firstname" />
    </label><br />
    <label>lastname   : <input type="text" name="lastname" />
    </label><br />
    <input type="submit" value="okey" />
    </form>

    Code PHP:
    <?php
    $firstname = $_POST['$firstname'];
    $lastname = $_POST['$lastname'];
    echo "alah yi5alek yaa $firstname $lastname ";
    ?>
    and after i apply values i only get this without the values which i wrote

    alah yi5alek yaa

    and it suppose to be alah yi5alek yaa value1 value2

    any idea there and thanks in advance
    ALWAYS LOOKING FORWARD

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Code php:
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];

    You don't need the $.
    Saul

  3. #3
    SitePoint Enthusiast cyber247's Avatar
    Join Date
    Dec 2007
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its still the same?? noth change
    ALWAYS LOOKING FORWARD

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Couple of things
    Your form should be:

    Code HTML4Strict:
    <form name="formname" action="welcome2.php" method="POST">
    <label>firstname :</label> <input type="text" name="firstname" />
    <br />
    <label>lastname :</label> <input type="text" name="lastname" />
    <br />
    <input type="submit" value="okey" />
    </form>

    Then on your receiving page (as php_daemon said)
    PHP Code:
    $firstname $_POST['firstname'];
    $lastname $_POST['lastname']; 
    but you can also add
    PHP Code:
    echo '<pre>';
    print_r($_POST);
    echo 
    '</pre>';

    $firstname $_POST['firstname'];
    $lastname $_POST['lastname']; 
    This should dump out all the information being sent through the post array.
    See what it gives you - if nothing comes through then the problem is elsewhere.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Enthusiast cyber247's Avatar
    Join Date
    Dec 2007
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it works now
    thanks guys alot
    ALWAYS LOOKING FORWARD


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
  •