Web url in form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Satterwhite

    Web url in form

    I have a form in which a user is going to enter (actually paste) a web
    address into a form field. The URL will have a query string (e.g.
    http://www.something.com?fld1=xxx&fld2=12345). When the form is posted, I
    properly receive the address in $_POST. After I process it, I want to put
    its value back into the field. Assuming the field name is v1, my <input>
    tag has the following field:

    ... value="' . $_POST['v1'] . '" ...

    Unfortunate, the query part of the string is truncated off and all that
    shows up in the field is the base portion of the URL. What PHP function
    will prepare the field such that the full URL - with query - will display
    in the field?
  • Alvaro G. Vicario

    #2
    Re: Web url in form

    *** Michael Satterwhite escribió/wrote (Mon, 21 Feb 2005 14:31:41 GMT):[color=blue]
    > ... value="' . $_POST['v1'] . '" ...[/color]

    .... value="' . htmlspecialchar s($_POST['v1']) . '" ...




    --
    -+ Álvaro G. Vicario - Burgos, Spain
    +- http://www.demogracia.com (la web de humor barnizada para la intemperie)
    ++ Manda tus dudas al grupo, no a mi buzón
    -+ Send your questions to the group, not to my mailbox
    --

    Comment

    • Michael Satterwhite

      #3
      Re: Web url in form

      Alvaro G. Vicario wrote:
      [color=blue]
      > *** Michael Satterwhite escribió/wrote (Mon, 21 Feb 2005 14:31:41 GMT):[color=green]
      >> ... value="' . $_POST['v1'] . '" ...[/color]
      >
      > ... value="' . htmlspecialchar s($_POST['v1']) . '" ...[/color]

      Thanks much. I appreciate it.
      ---Michael

      Comment

      • Daniel Tryba

        #4
        Re: Web url in form

        Michael Satterwhite <satterwh.X$NO$ S$PAM@weblore.c om> wrote:[color=blue][color=green][color=darkred]
        >>> ... value="' . $_POST['v1'] . '" ...[/color]
        >>
        >> ... value="' . htmlspecialchar s($_POST['v1']) . '" ...[/color]
        >
        > Thanks much. I appreciate it.[/color]

        This will break if value is delimited with single quotes (see ENT_QUOTES
        in htmlspecialchar s).

        Comment

        Working...