www.webdeveloper.com
Results 1 to 4 of 4

Thread: Redirect to another php page if there are no paramters passed in the url

  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Red face Redirect to another php page if there are no paramters passed in the url

    I'm trying to redirect to another php page if there are no paramters passed in the URL. I've tried using
    if (!isset($_GET[id'])...
    but it doesn't seem to be working. I've searched high and low for a solution to this but haven't been able to find one. Any ideas?

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,537
    If you just want to know if there were no URL query string parameters:
    PHP Code:
    if(count($_GET) == 0) {
       
    header("Location: http://example.com/");

    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jul 2011
    Posts
    2
    That was both way simple and it worked perfectly, THANKS!

  4. #4
    Join Date
    Mar 2011
    Posts
    79
    The forum experts should write a book on the most common techniques used in php. Time tested and proven and then post it on smashwords. i got a book on smashwords got about 40 downloads. its for free though.

    would help a lot of us newbies.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles