Web Analytics Made Easy -
StatCounter newbie question - CodingForum

Announcement

Collapse
No announcement yet.

newbie question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • newbie question

    Hi, I'm learning PHP in this moment and my tuturial give me this code:

    Code:
    <HTML>
    <FORM>
    Please type your name here:<BR>
    <INPUT TYPE=TEXT NAME=username><BR><BR>
    <INPUT TYPE=SUBMIT VALUE="Submit data">
    </FORM>
    <BR><BR>
    You typed:
    
    
    <?php
    echo ($username);
    
    ?>
    
    </HTML>
    But it won't work. Why? Thanks

  • #2
    i won't even begin to mention all of the problems with that code...lol...

    try this:

    Code:
    <html>
    <body>
       <form action="test.php" method="POST">
          <input type="text" name="username" /><br/><br/>
          <input type="submit" value="Submit Data"/ ><br/><br/>
       </form>
    </body>
    </html>
    and then in a file called "test.php", put the following:

    PHP Code:
    <?php print $_POST["username"];?>

    Comment


    • #3
      well I'm using easyphp, and I think it's something because of that program.
      Can I configure in another way, or there is any other program?
      thanks
      Last edited by devil_online; Feb 8, 2004, 03:18 PM.

      Comment


      • #4
        Re: newbie question

        <!--this should be in your HTML file-->
        <HTML>
        <FORM>
        Please type your name here:<BR>
        <INPUT TYPE=TEXT NAME=username><BR><BR>
        <INPUT TYPE=SUBMIT VALUE="Submit data">
        </FORM>
        <BR><BR>
        You typed:


        <?php
        //this should be in your PHP file
        echo ($username);

        ?>
        I think this is the way that this should work...that way you send the $username to through the URL. I am not 100% for sure, because I am also sort of a newbie
        thanks
        bri

        Comment


        • #5
          That won't work, that's almost identical to his script.

          If you just want it all on one page, then first sort the html out.
          PHP Code:
          <html>
          <head>
          <title>Blah</title>
          </head>
          <body>
          <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
          Please type your name here:<br>
          <input type="text" name="username"><br><br>
          <input type="submit" value="Submit data">
          </form>
          <br><br>
          <?php
          echo 'You typed: '.$_POST['username'];
          ?>
          </body>
          </html>

          Comment


          • #6
            Re: newbie question

            Originally posted by devil_online
            Hi, I'm learning PHP in this moment and my tuturial give me this code:

            Code:
            <HTML>
            <FORM>
            Please type your name here:<BR>
            <INPUT TYPE=TEXT NAME=username><BR><BR>
            <INPUT TYPE=SUBMIT VALUE="Submit data">
            </FORM>
            <BR><BR>
            You typed:
            
            
            <?php
            echo ($username);
            
            ?>
            
            </HTML>
            But it won't work. Why? Thanks
            You need to read our posting guidelines before creating anymore topics
            Spookster
            CodingForum Supreme Overlord
            All Hail Spookster

            Comment


            • #7
              well thanks but the problem it's with easyphp, anyone know a good program like easyphp? thanks

              Comment


              • #8
                Uhm, yes. Look at the sticky thread of this forum. It's the one at the top, starting with "PHPDEV"...
                De gustibus non est disputandum.

                Comment


                • #9
                  i've download, but I can figure out to creat data bases in MYSQL. In easphp was easy. Thanks

                  Comment


                  • #10
                    I guess you read the FAQ and the manual? AFAIK, this package ships with phpMyAdmin. With this application it's a piece of cake to create databases. I don't use PHPDEV though, but for installing it would be better to ask again and to give some more details.

                    Your initial question is solvable without any database access. Does it work now?
                    De gustibus non est disputandum.

                    Comment


                    • #11
                      ya it works. thanks

                      Comment

                      Working...
                      X