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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    45
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Please...please help, very big problem!

    Everytime I make a form, it doesn't work. And what I mean by that is, when I open my form.php file on Mozilla Firefox, It opens with my form. Now, I type in the Information and when I click submit, and go to form_response.php it doesn't show the information that I typed in.

    It does this for any form I make. Here are my codes:

    PHP Code:
    <h1>1337programs Fill-out before entering (Optional)</h1>

    <
    div style="padding:15px; border:1px solid #666666; background-color: #F5F5F5">



    <
    form method="post" action="form_response.php">

             <
    div class="form_element_div">
               
    First name: <br> <input name="name_first" type="text" size="50" maxlength="200">
          </
    div>
            <
    div class="form_element_div">
               
    Email: <br><input name="email" type="text" size="50" maxlength="200">
       </
    div>
       
       
       
                          <
    div class="form_element_div">
                          
    Favorite color:
                           <
    INPUT type=radio value="red" name="color">
                           
    red
                           
    <INPUT type=radio value="yellow" name="color">
                           
    yellow
                           
    <INPUT type=radio CHECKED value="blue" name="color">
                           
    blue
                           
    <input type="submit" />
                           
        </
    div
    Now here is the second part, form_response.php:

    PHP Code:
    <div id="topBar"></div>
    <div id="navigation" class=container"></div>
    <div id="centerDoc" class="container">
    <div style="margin-top:25px; margin-bottom:20px; ">  </div>


    <div>

    <?php

    // FORM PROCESSING CODE- USING 'SUPER GLOBALS' - 1337programs.110mb.com


    $first_name $_POST['name_first'];
    $email $_POST['email'];










    ?>

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,077
    Thanks
    2
    Thanked 320 Times in 312 Posts
    Forms need closing tags to make them valid -

    </form>
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    You set the variables, but didn't echo them out. Delete your code in form_response and use this one.

    PHP Code:
    <div id="topBar"></div>
    <div id="navigation" class=container"></div>
    <div id="centerDoc" class="container">
    <div style="margin-top:25px; margin-bottom:20px; ">  </div>


    <div>

    <?php

    // FORM PROCESSING CODE- USING 'SUPER GLOBALS' - 1337programs.110mb.com


    $first_name $_POST['name_first'];
    $email $_POST['email'];

    echo 
    "Your first name is <b>$first_name</b><br>";
    echo 
    "Your email is <b>$email</b>";

    ?>

  • #4
    New Coder
    Join Date
    Jan 2009
    Posts
    45
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by masterofollies View Post
    You set the variables, but didn't echo them out. Delete your code in form_response and use this one.

    PHP Code:
    <div id="topBar"></div>
    <div id="navigation" class=container"></div>
    <div id="centerDoc" class="container">
    <div style="margin-top:25px; margin-bottom:20px; ">  </div>


    <div>

    <?php

    // FORM PROCESSING CODE- USING 'SUPER GLOBALS' - 1337programs.110mb.com


    $first_name $_POST['name_first'];
    $email $_POST['email'];

    echo 
    "Your first name is <b>$first_name</b><br>";
    echo 
    "Your email is <b>$email</b>";

    ?>
    I did that, and went I hit the submit button, and go to form_response.php I get this:

    Code:
    $_POST ['name_first'];
    "; echo "Your email is $email"; ?>

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    What webhost are you using?
    Maybe the don't allow PHP scripting?

  • #6
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    True its very possible your webhost doesn't support it. 99.9% of free hosts don't support it.

  • #7
    New Coder
    Join Date
    Jan 2009
    Posts
    45
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I'm using my localhost.

  • #8
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,700
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    May it be this reason?

    Also, did you exactly copy the code masterofollies provided? Because in your response about the results I see a whitespace (between $_POST and the array object) where no whitespace should occur. And also I don’t see if this is the full output. It may also be that you aren’t pairing quotes correctly. Single quotes and double quotes are mutually exclusive. That means you can’t write $_POST['name_first"]; and expect an acceptable result it should always be the same kind of quote around a string. And if you need to use quotes inside another quoted section you need to either escape the quote with a backslash or use the other type of quotes inside one type (i. e. if you have ouble quotes you need to use single quotes inside that string and vice versa).

    Also, what’s the error message PHP should shouw you?
    Last edited by VIPStephan; 05-24-2009 at 05:59 PM.

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by SRBuckey5266 View Post
    I'm using my localhost.
    Do you have a server and php installed?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    Regular Coder ArcticFox's Avatar
    Join Date
    Jan 2004
    Location
    Vostok Station, AQ
    Posts
    602
    Thanks
    35
    Thanked 3 Times in 3 Posts
    <div id="topBar"></div>
    <div id="navigation" class=container"></div>
    <div id="centerDoc" class="container">
    <div style="margin-top:25px; margin-bottom:20px; "> </div>
    <div> - putting your mind in a box since 1997

  • #11
    New Coder
    Join Date
    Jan 2009
    Posts
    45
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Can someone just post their own codes and let me test it?

  • #12
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    We have but the fact that you seeing the php means its an issue with your system.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #13
    Regular Coder ArcticFox's Avatar
    Join Date
    Jan 2004
    Location
    Vostok Station, AQ
    Posts
    602
    Thanks
    35
    Thanked 3 Times in 3 Posts
    Did anyone try putting a quotation mark in the area I suggested above?
    <div> - putting your mind in a box since 1997

  • #14
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Putting the quote in above won't effect the php output since its client side and not server side. The php runs first then the html.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #15
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Upload the PHP script below and see if it shows you the result:

    PHP Code:
    <?php
    $x
    =3;
    echo
    "The sum is: $x";
    ?>
    Tell us what it shows.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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