form help

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

    #16
    I don't know what exactly what you want to do, cos the variables will most likely be trimmed. Moreover putting a space after username will most likely break the url.
    Perfection comes at a cost



    I accept liberty!

    Comment


      #17
      it will not break the url
      i have tryed by somthing else code but it showing %2520 at the url
      but i want a space not %2520

      Comment


        #18
        you can not have a space in a url .... it is url encoded so %20 or %2520 is a space

        you can use
        PHP Code:
        $user urldecode ($user); 
        To decode the encoded url
        Last edited by something else; 24.12.10, 11:29.

        Comment


          #19
          The url is automatically decoded upon receipt.

          Thing is, if the space is after username, then it is before = which should break the url.
          Perfection comes at a cost



          I accept liberty!

          Comment


            #20
            i have try that
            $user = $_POST['user'];
            $user = urldecode ($user );
            but it dosnt work
            @forstymarvelous
            showing friends a trick
            if the link entered without space will show the friends marked as private but if there a space after the username will show the friends, get it ?

            Comment


              #21
              Did you tried the code that I've edit from your post?
              I think you can do that by getting first the value of $user then make a link
              Like what I've posted at http://coding-talk.com/f14/form-help...html#post65596
              Did I help you?
              You can help me too
              Your donations will help me finance my studies.

              Comment


                #22
                if i am right, you need a code to check for a space after the username or else display a
                users are private message.
                this should work if that is what you need.
                try putting in a username without the space after and also try with the username after.
                it places the space after the username in the url.
                if this is not it, please clarify.
                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']))
                {
                $diffstrlen($_POST['user']) - strlen(rtrim($_POST['user']));// i separated this from the original code
                                                                                      //which was in the if statement
                  //so you can choose if the space left or right
                  //of the username by using either rtrim or ltrim 
                  //and also choose the number of spaces required
                if ($diff == 1)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 
                "Friends are private"
                }
                else echo 
                "Username or Page cannot be blank!";
                }
                ?>
                </body>
                </html>
                Perfection comes at a cost



                I accept liberty!

                Comment


                  #23
                  i have created my code and its working now thanks forstymarvelous,kei_ki7 and something else

                  Comment

                  Working...
                  X