form help

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

    form help

    i want to make a form add a space behind the username
    iam using

    username:<br>
    <form action="http://www.mig33.com/midlet/member/view_friends.php">
    <input name="username" hidden value=" "><br>
    page number: <br><input name="pagenum">
    <br>
    <input type="submit" value="find Friends">
    </form>
    <br>

    but it going to link

    i want to add aumaticly space after atef
    like that link
    http://www.mig33.com/midlet/member/v...?username=atef &pagenum=1

    #2
    i have created that

    1.php

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Friends Viewer</title>
    </head>
    <body>

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

    Username: <br>
    <input type="text" name="user" size="35" />
    <br>
    Page:<br>
    <input type="text" name="page" size="35" />
    <br>
    <input type="submit" value="View" />
    <br>
    </form>

    </body>
    </html>

    and vf.php

    <?php


    $user = $_POST['user'];
    $page = $_POST['page'];



    ?>


    <?php
    echo '<p align="center">';

    print "<a href=\"http://www.mig33.com/midlet/member/view_friends.php?username=$user &pagenum=$page\">Viewe $user Friends</a><br/>";

    ?>

    but it dosnt working at mobile browser please any1 help

    Comment


      #3
      I don't know what you mean by you want a space.

      Btw. You made a form and did not even specify if it was to send data using the get or post method, and you tried using post.

      Instead of $_POST, try using $_GET.
      Perfection comes at a cost



      I accept liberty!

      Comment


        #4
        its not woking too

        Comment


          #5
          PHP Code:
          $username ' '.$_POST['username']; //space before username 

          Comment


            #6
            I just rEread both posts. CAn you specify which one you need help with? and exactly what?

            the seCond one is perfect, but your first post lacks in many aspects. you need to first of all correct the form to be standard html. mobile browsers are limited in correcting malformed html.
            Perfection comes at a cost



            I accept liberty!

            Comment


              #7
              thanks for all who help
              i am created it now and its totaly working
              now how to make the 2 pages at 1 php page
              like the auto index who working by 1 page

              Comment


                #8
                what no body know how? :s

                Comment


                  #9
                  now how to make the 2 pages at 1 php page
                  What does that mean?
                  Perfection comes at a cost



                  I accept liberty!

                  Comment


                    #10
                    just use if()
                    PHP Code:
                    <?php
                    $action
                    =$_GET['action'];
                    if(!
                    $action) {
                    // do something
                    } else {
                    // do something else 
                    }
                    ?>
                    to show something else you need to have page.php?action=aaa
                    If you use page.php it will show something...

                    Comment


                      #11
                      i have created that
                      Code:
                      <?php
                      echo '<html>';
                      echo '<head>';
                      echo '<title>View Friends</title>';
                      echo '</head>';
                      echo '<body>';
                      
                          echo '<form action="p.php?action=view" method="post">';
                         echo 'Username:<br><input name="user" maxlength="50" /><br>';
                         echo 'Page:<br><input name="page" maxlength="200" value="1" /><br>';
                         echo '<input type="submit" value="View">';
                         echo '</form>';
                      
                      echo '</body></html>';
                      
                      if($_GET['action']=='view')
                      {
                      $user=$_GET['user'];
                      $page=$_GET['page'];
                      print "<a href=\"http://www.mig33.com/midlet/member/view_friends.php?username=.$user. &pagenum=.$page."\">Viewe .$user. Friends</a><br/>";
                      } 
                      ?>
                      but it not working

                      Added after 3 minutes:

                      @frostymarvelous
                      i want to make the html form and php code at same page like that code i posted
                      Last edited by atef201080; 23.12.10, 01:05.

                      Comment


                        #12
                        Hope this helps
                        PHP Code:
                        <html>
                        <head>
                        <title>View Friends</title>
                        </head>
                        <body>
                        <?php
                        if (!isset($_POST['action'])){
                        echo <<<FORM
                        <form action="" method="post">
                        <label for="username">Username:</label><br />
                        <input type="text" id="username" name="user" maxlength="50" placeholder="Enter your username" /><br />
                        <label for="pg">Page:</label><br />
                        <input type="text" id="pg" name="page" maxlength="200" value="1" size="2" /><br />
                        <input type="submit" name="action" value="View">
                        FORM;
                        }
                        else{
                        if (!empty(
                        $_POST['user']) && !empty($_POST['page'])) echo "<a href=\"http://mig33.com/midlet/member/view_friends.php?username=$_POST[user]&amp;pagenum=$_POST[page]\">
                        View 
                        $_POST[user]'s Friends.</a><br />
                        <a href=\"p.php\">Back</a>"
                        ;
                        else echo 
                        "Username or Page cannot be blank!";
                        }
                        ?>
                        </body>
                        </html>
                        Perfection comes at a cost



                        I accept liberty!

                        Comment


                          #13
                          <?php
                          echo '<html>';
                          echo '<head>';
                          echo '<title>View Friends</title>';
                          echo '</head>';
                          echo '<body>';

                          echo '<form action="p.php?action=view" method="post">';
                          echo 'Username:<br><input name="user" maxlength="50" /><br>';
                          echo 'Page:<br><input name="page" maxlength="200" value="1" /><br>';
                          echo '<input type="submit" value="View">';
                          echo '</form>';

                          echo '</body></html>';

                          if($_GET['action']=='view')
                          {
                          $user=$_GET['user'];
                          $page=$_GET['page'];
                          print "<a href=\"http://www.mig33.com/midlet/member/view_friends.php?username=.$user. &pagenum=.$page."\">Viewe .$user. Friends</a><br/>";
                          }
                          ?>

                          The quote in red is the error

                          Added after 11 minutes:

                          Try this, Im not sure if that is what you want.
                          PHP Code:
                          <?php
                          echo '<html>';
                          echo 
                          '<head>';
                          echo 
                          '<title>View Friends</title>';
                          echo 
                          '</head>';
                          echo 
                          '<body>';

                             echo 
                          '<form action="p.php" method="get">';
                             echo 
                          'Username:<br><input name="user" maxlength="50" /><br>';
                             echo 
                          'Page:<br><input name="page" maxlength="200" value="1" /><br>';
                             echo 
                          '<input name="action" type="hidden" value="view" /><br>';
                             echo 
                          '<input type="submit" value="View">';
                             echo 
                          '</form>';

                          echo 
                          '</body></html>';

                          if(
                          $_GET['action']=='view')
                          {
                          $user=$_GET['user'];
                          $page=$_GET['page'];
                          print 
                          "<a href=\"http://www.mig33.com/midlet/member/view_friends.php?username=$user &pagenum=$page\">Viewe $user Friends</a><br/>";

                          ?>
                          Last edited by kei_ki7; 23.12.10, 05:22.
                          Did I help you?
                          You can help me too
                          Your donations will help me finance my studies.

                          Comment


                            #14
                            @frostymarvelous
                            thanks you bro
                            please if you can contact me at
                            blackgun2002@yahoo.com

                            Added after 22 minutes:

                            please how to make space after username
                            echo "<a href=\"http://mig33.com/midlet/member/view_friends.php?username=$_POST[user]&amp;pagenum=$_POST[page]\">
                            to change the link like that
                            http://www.mig33.com/midlet/member/v...?username=user &pagenum=1
                            Last edited by atef201080; 23.12.10, 15:03.

                            Comment


                              #15
                              why would you want a space after then name in the url when you can easily create one on the page its directed to
                              eg:
                              PHP Code:
                              $user $_GET['user'].' '//space after username 

                              Comment

                              Working...
                              X