Results 1 to 3 of 3

Thread: redirect with header and Dynamic URL

  1. #1
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default redirect with header and Dynamic URL

    Hi everybody,

    Could someone tell me what i'm forgetting in there?

    Code:
    header('refresh:5;url=suivant.php?ID_info=$row_Promo_val_suiv['ID_info']');
    It returns me :

    Parse error: parse error, unexpected T_STRING in c:\program files\easyphp1-8\www\passage_sessions\suivants.php on line 53
    My variable works because without the redirection it shows the correct value.
    I guess it must be stupid

    Thanks for any help .


    Solution applied:
    Code:
    $urlsuivant = "promo.php?ID_promo=" .$row_promos['ID_info'];
    
    
    header("refresh:5;url= $urlsuivant");
    Last edited by noobster; 02-13-2008 at 03:13 PM. Reason: SOLVED in a way

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Not that you need it now, but the problem was
    PHP Code:
    header('refresh:5;url=suivant.php?ID_info=$row_Promo_val_suiv['ID_info']'); 
    Should be
    PHP Code:
    header('refresh:5;url=suivant.php?ID_info='.$row_Promo_val_suiv['ID_info'].''); 
    You string started with ' and had ' in the middle, causing the parse error. Also, the value won't be placed in a string if its in single quotes, and an array value won't be in a string unless you concat it in.
    You got it right in the second bit of code, which is why it works
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  3. #3
    Join Date
    Jun 2006
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks anyway for the reply, it gives me a bit more of explanation. and also another way wich is always good to know

    thanks

Bookmarks

Posting Permissions

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