954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

using multiple php files

Hi guys,

This may seem a little simple, but I'm new to html/php programming so here goes

I have a listbox with six items on my page.

I would like to call a different php file depending on what option was selected

psudo code would be

if selection = 1 then use 1.php
if selection = 2 then use ...

Is this possible?
Any sample code would be very helpful.

My page has a variety of barcode types, and I would like to use the same input page but call different functions depending on which option was selected.

N eil

nrbsneil
Newbie Poster
3 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

you use include function.
u can read more here
http://us3.php.net/manual/en/function.include.php

mrcniceguy
Posting Whiz in Training
283 posts since Mar 2008
Reputation Points: 17
Solved Threads: 8
 

something like this would be helpful:

switch($var)
{
     case 1: include("1.php");
     break;
     case 2: include("2.php");
     break;
     case 3: include("3.php");
     break;
}
sikka_varun
Junior Poster in Training
94 posts since Dec 2008
Reputation Points: 11
Solved Threads: 12
 

Many thanks mrcniceguy

Will look into this. I thought it must be straightforward.

Neil

you use include function. u can read more here http://us3.php.net/manual/en/function.include.php
nrbsneil
Newbie Poster
3 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You