SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    a href with header

    I need help please.

    I have one page on which I have an <a href="control.php">
    In control.php I have to do some "things" with the datas and the database, and then I have to redirect to the <a href>.

    This is what I though:

    first_page
    <a href="control.php?link=wwwgooglecom">google[/url]

    control.php
    ...control of the data...
    Header

    My question is, how do I have to do the header? Any other solution?

    Thank you.

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    // control.php
    $link $_GET['link'];
    header("Location: http://$link");
    exit; 
    my mobile portal
    ghiris.ro

  3. #3
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do you mean a header to redirect to another page?

    PHP Code:
    header('Location: http://some.url.com/');
    exit(); 

  4. #4
    SitePoint Guru
    Join Date
    Feb 2008
    Posts
    655
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not completely sure what you mean.

    Are you trying to use header() to redirect to a new location based on the URL in the query string?

    If so use
    PHP Code:
    header("Location: " $_GET['link']); 
    If this is not what you mean then please post again with a little clarification.

  5. #5
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, thank you very much, it was I needed.

    Other question:

    How can I open the new window in a different window. I mean:


    I have the main page "page.php", then I have "control.php" and then I call "googlehtml" for example.

    How can I have two differents pages, one, "page.php" and the other one "googlehtml".

    Thank you.

  6. #6
    SitePoint Member
    Join Date
    Jul 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found the solution:

    <a href="control.php?link=wwwgooglecom" target="_blank">google</a>

    Thank you.


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
  •