Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: $_get

  1. #1
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    $_get

    I have a problem with the $_GET
    i'm sending like this:

    print "\t<td><div align=center><a href=\"Base_actualiza1_cadastro1.php?menu1=$FirstName\" onClick='showPopup(this.href);return(false);'>".$FirstName."</a></div></td>\n";

    <script type="text/javascript">
    function showPopup(url) {
    newwindow=window.open(url,'name','height=500,width=620,top=200,left=300,scrollbars=no');
    if (window.focus) {newwindow.focus()}
    }
    </script>


    And i get it:

    $nome =$_GET['menu1'];

    But the problem is if the ?menu1=A. FERREIRA PEDRO & IRMÃO

    It only echo= A. FERREIRA PEDRO

    But in the URL it Apears A. FERREIRA PEDRO & IRMÃO


    Can please someone help me

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Ampersands are used in building query strings:
    Code:
    ?name=John&zip=12345
    Yields:
    PHP Code:
    $_GET['name']; // `John`
    $_GET['zip']; // `12345` 
    So this query string:
    Code:
    ?menu1=A. FERREIRA PEDRO & IRMÃO
    Will come out looking something like:
    PHP Code:
    $_GET['menu1']; // `A. FERREIRA PEDRO `
    $_GET[' IRMÃO']; // empty string 
    have a look at:
    http://www.php.net/urlencode
    http://www.php.net/urldecode
    Last edited by kbluhm; 01-22-2010 at 04:12 PM.

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    The & symbol signifies the next variable in the URL.

    Try &amp; (for ampersand) and see if that works.
    Even though there's a "&" in &amp; I think it might work.

    Or, change & to the word "and".

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Try
    PHP Code:
    print "\t<td><div align=center><a href=\"Base_actualiza1_cadastro1.php?menu1=".urlencode($FirstName)."\" onClick='showPopup(this.href);return(false);'>".$FirstName."</a></div></td>\n"
    Last edited by abduraooft; 01-22-2010 at 04:29 PM. Reason: extra L :(
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Tulungo (01-22-2010)

  • #5
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Excelent it works with ".urlencode($FirstName)." but your post =".urlenclode($FirstName)." one "L" more

    Thanks!!!!!!!

  • #6
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,342
    Thanks
    13
    Thanked 349 Times in 345 Posts
    Quote Originally Posted by mlseim View Post
    Try &amp; (for ampersand) and see if that works.
    Even though there's a "&" in &amp; I think it might work.
    it doesn’t work. in XHTML it is even required to use &amp;.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •