Just curious is all . . .

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CodeNoobster
    New Member
    • Sep 2013
    • 52

    Just curious is all . . .

    Sup guys (and girls).So iv'e dabbled in a little bit of PHP lately and decided to try this out. This isn't homework or an assignment, its just experimentation . However this has answered some questions and raised a few as well.

    Code:
    <?php
    echo 'What is your name?<p>';
    echo "<form action=\"huh.php\" method=\"POST\">";
    echo "<input type=\"text\" name=\"yourname\">";
    echo "<input type=\"submit\" name=\"submit\">";
    echo "</form>";
    
    if (isset($_POST["yourname"])&&!empty($_POST["yourname"])){
    $name = $_POST["yourname"];
    echo 'your name is '.$name.'. Thank you for telling me'; 
    }
    ?>
    I would like to know if there are any benefits to using separate HTML code to get form data or is this the best way to go about doing that, and if there are other uses for outputting html in PHP . . . thanks in advance . . .
  • Claus Mygind
    Contributor
    • Mar 2008
    • 571

    #2
    Since you can bounce in and out of php sometimes it can be less coding and easier to read if you only box in the php code and leave the rest pure html.

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      I would like to know if there are any benefits to using separate HTML code
      you can modify the HTML without touching the PHP script (and add an error there).

      Comment

      • CodeNoobster
        New Member
        • Sep 2013
        • 52

        #4
        @ Claus and Dormilich : Many thanks :) . . .

        Comment

        Working...