Results 1 to 2 of 2

Thread: Print Simple User Input to Website

  1. #1
    Join Date
    Nov 2010
    Posts
    28
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question Print Simple User Input to Website

    Very simple and basic code, but I need help. Suppose I have two input fields in a form with a submit button--one for the user's name, and one for the user's message. When the user clicks submit, I'd like the name and the message to be printed to the webpage. What PHP code(s) will get this done? I greatly appreciate any answers!!!

  2. #2
    Join Date
    Dec 2008
    Posts
    48
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    PHP Code:
    <?php

    $username     
    $_REQUEST["username"];
    $message     $_REQUEST["message"];


    if (
    strlen($message) > and strlen($username) > 0)
        {
        
    ?>
        Submited: <? echo $message ?> by <? echo $username ?>
        <?
        
    }

    ?>

    <form action="" method="post" >

    <label>
    <input type="text" name="username" id="username">
    </label>
    <label>
    <input type="text" name="message" id="message">
    </label>
    <input type="submit" value="Submit" />

    </form>

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
  •