Php Problem T_ENCAPSED_AND_WHITESPACE Need Help!!!

Discussion in 'Programming' started by Melvinng, Apr 12, 2008.

  1. #1
    I have this line of code:

    
    function smile($aurl)
    ...
    ...
    ...
    header("Location: smile($_GET['url'])");
    Code (markup):
    and it keeps on giving me this error:

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/admin/domains/site.com/public_html/test.php on line 23
    Code (markup):
    What am I doing wrong, can someone help me rewrite the code to make it work?
     
    Melvinng, Apr 12, 2008 IP
  2. Melvinng

    Melvinng Peon

    Messages:
    850
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I also tried this:
    
    function smile($aurl)
    ...
    ...
    ...
    $aurl= $_GET['url'];
    $linksmile=smile($aurl);
    header("Location: $linksmile");
    Code (markup):
    and I got this:

    
    Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/site.com/public_html/test.php:2) in /home/admin/domains/site.com/public_html/test.php on line 64
    Code (markup):
     
    Melvinng, Apr 12, 2008 IP
  3. VoYdE

    VoYdE Peon

    Messages:
    95
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    whats in the "...."'s?

    and what are you trying to do?

    (Something with a function to redirect based on a link variable?)
     
    VoYdE, Apr 12, 2008 IP
  4. Melvinng

    Melvinng Peon

    Messages:
    850
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, the ... are the rest of the script, this is one part of my encryption script, I really can't share the rest because there would not be a point of encryption if I shared the rest.
     
    Melvinng, Apr 13, 2008 IP
  5. iceangel89

    iceangel89 Guest

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    u cant have single quotes in double quotes

    try

    header("Location: smile($_GET[url])");
    PHP:
     
    iceangel89, Apr 13, 2008 IP
  6. backlinkpal

    backlinkpal Peon

    Messages:
    322
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I believe your headers must be the first line in your page before any HTML
     
    backlinkpal, Apr 16, 2008 IP