dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: php and forms

  1. #1
    I Like To Flash in Public ;) thebluedragon's Avatar
    Join Date
    Aug 2001
    Location
    London, U.K
    Posts
    194

    php and forms

    hi there, i have a simple for with a name, last name and email text fields. and what im trying to do is write a php program which will just send me the details back.

    so for eg. i have a form and i type in my details. then the php will creata a page which wills ay, is the follwoing info coprrect, and it will display on the screen the information i entered in my form, here is my code.

    i just cant get ti to show my values!


    ---------html code------------

    <html>
    <head>
    <title>Untitled Document</title>

    </head>

    <body >

    <form method="post" action="http://localhost/HCI/tickets2.php">
    <p>Name:
    <input name="fname" type="text">
    </p>
    <p>
    Surname:
    <input name="lname" type="text">
    </p>

    <p>Email:
    <input name="email" type="text">
    </p>
    <p>
    <input type="submit" name="Submit" value="Buy Tickets">
    <input name="reset" type="reset" id="reset" value="Reset this form">
    </p>
    <p>&nbsp;</p>
    </form>

    </body>
    </html>


    -------------------------------------------------------------

    this is my php code.

    --------------------------------------------------------------------------
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>

    </HEAD>

    <BODY>
    <H1>Is this information all correct before your complete your order?</H1>
    <table>
    <tr>
    <th>Your Name</th>
    <td><?php echo $fname; ?></td>
    </tr>
    <tr>
    <th>Your Last Name</th>
    <td><?php echo $lname; ?></td>
    </tr>
    <tr>
    <th>Your Email</th>
    <td><?php echo $email; ?></td>
    </tr>
    <tr>
    <th>The Film You brought ticket for is:</th>
    <td><?php echo $film; ?></td>
    </tr>
    <table>
    </BODY>
    </HTML>
    --------------------------------------------------------------


    what am i doing wrong? it just displays my headrers but not the actual data i want from my form!

    Please help me

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    You enter the variables in the form, and they are sent to the second page via post.

    It hasn't always been like this, I think, but for security reasons you have to call the variables that are in the $_POST array:
    PHP Code:
    <?php echo $_POST['fname']; ?>
    //
    <?php echo $_POST['lname']; ?>
    // and so on
    simlilarly, you'd use $_GET if you had used get, or manually appended variables (query string) to the url.

    read $_POST.
    other predefined variables.

  3. #3
    Registered User
    Join Date
    Jan 2003
    Location
    england
    Posts
    131
    hello
    shouldn't that echo thing work with sending flash variables to php?
    I mean if I used:
    loadVariablesNum ("test.php", "0", "Post");
    in the flash to send all variables (I have only one at the mo called 'namein')
    and then i used this in the php file:
    $temp = echo $_POST['namein'];
    ...
    $query = "INSERT INTO $table (id, password, name, email, date) VALUES ('', 'sfgfg','$temp', '', '')";
    ..
    shouldnt it work?
    its not.....

    Shaf

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    It should be:
    PHP Code:
    $temp $_POST['namein'];

    $query "INSERT INTO $table (id, password, name, email, date) VALUES ('', 'sfgfg','$temp', '', '')"

  5. #5
    Registered User
    Join Date
    Jan 2003
    Location
    england
    Posts
    131
    THANK YOU!
    SHAF

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

HTML5 Development Center