Trouble posting form data on next page

Discussion in 'PHP' started by kdubbie, Oct 3, 2010.

  1. #1
    Hi, I have a form on my website that once submitted, I want the data to be posted on the page it redirects to.

    Here is what I am doing (with just one of the form fields)

    Form
    <input type="text" name="fname" id="fname" size="30" />

    PHP code on next page

    <?php

    $fname = $_POST ['fname'];

    echo "<p>The following information has been submitted:</p>";
    echo "<p>First Name: " . $fname . "</p>";


    ?>

    The crazy thing is this...It was working at one point, the data from the form was being posted with the above code...but now I have no idea what happened, it just all of a sudden stopped working.

    Any help would be great!!!
     
    kdubbie, Oct 3, 2010 IP
  2. axelay

    axelay Peon

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?php
    
    $fname = $_POST['fname'];
    
    echo "<p>The following information has been submitted:</p>";
    echo "<p>First Name: " . $fname . "</p>";
    
    
    ?>
    PHP:
    There seemed to be a blank space between the $_POST and ['fname']. Try correcting this and test again ;)

    aXe
     
    axelay, Oct 3, 2010 IP
  3. imperialDirectory

    imperialDirectory Peon

    Messages:
    395
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    did you wrap the <form> tag around the textbox?
     
    imperialDirectory, Oct 4, 2010 IP