LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-16-2004, 02:04 PM   #1
agallant
Member
 
Registered: Oct 2003
Location: D.C USA
Distribution: Redhat 9. Thinking about Slackware
Posts: 166

Rep: Reputation: 30
Bad programing, PHP


ok bad programming here but if some one could help me make it work i would be greatfull. Actuailly it is a combination of PHP, Basic and what ever else came out of my head but it is for a PHP file.

GET_($_get['ID'], "test");
If $_ID = "55" than go to "../55.thm",
If $_ID = "44" than go to "../44.htm"
Else go to "../yoursol.htm";


Ok, BAD code i know.

Thanks

-AG
 
Old 07-16-2004, 03:04 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Go to www.php.net and learn a little

PHP Code:
switch( $_GET["test"] )
{
    case 
"55" header"Location: ../55.thm" );
    case 
"44" header"Location: ../44.htm" );
    default:  
header"Location: ../yoursol.htm" );

 
Old 07-16-2004, 04:25 PM   #3
schoeppchen
LQ Newbie
 
Registered: Jul 2004
Posts: 29

Rep: Reputation: 15
Don't ever forget to break out:

PHP Code:
switch( $_GET["test"] ) 

    case 
"55" : { header"Location: ../55.thm" );  break; }
    case 
"44" : { header"Location: ../44.htm" );   break; }
    default:  
header"Location: ../yoursol.htm" ); 

 
Old 07-17-2004, 01:39 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
In fact I thought break's were not needed as header() redirects to another page without execute the following instructions.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/usr/bin/php: bad interpreter :::what install to avoid this message. Thank you sarajevo Linux - Software 1 09-23-2005 09:38 AM
Getting Started with Programing dosnlinux Linux - Software 5 04-29-2005 03:28 PM
Script programing agallant Programming 6 12-01-2003 10:12 PM
C++ GUI programing calble Programming 6 10-10-2003 12:25 PM
Kernal Programing FBD Programming 3 02-02-2002 12:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration