LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   php function to open an html page (https://www.linuxquestions.org/questions/linux-software-2/php-function-to-open-an-html-page-332961/)

prabhatsoni 06-13-2005 01:10 AM

php function to open an html page
 
Hello everybody,

I have this php code in a script which has a switch statement:

Code:

<?php
 include "/usr/local/include/php/fns.php";
?>
<html>
<head><title>Bla blah Blah</title></head>
<body bgcolor="pink">
<?php
 switch($_POST['act_choice'])
  {
    case "pgpr":
        pgpr_form1();
        break;
    case "alpha":
        alpha_form1();
        break;
    case "vpt":
        vpt_form1();
        break;
  }
?>
</body>
</html>

Is there a php function which can directly open a given html page. In above case, I want that in case "ppr" a form (say ppr_form.html) should open, similarly for case "alpha" a form - alpha_form.html, should be opened. I believe there is some php function which should do it.

Can anyone guide a greenhorn like me?


Thanks in advance.


Prabhat Soni

Boby 06-13-2005 06:05 AM

Hi!

You can use:
PHP Code:

case "pgpr":
   if(
file_exists("ppr_form.html"))
      include 
'ppr_form.html';
   break; 

This will include the content of "ppr_form.html" at that place in your main page.

Or redirect to a new page, this will show only "ppr_form.html" as new page without including it in your main page:
PHP Code:

case "pgpr":
   
header("Refresh: 0;url=ppr_form.html");
   break; 

Cheers, Boby!

prabhatsoni 06-13-2005 11:32 PM

Thanks Boby,
You have been of immense help.



Prabhat Soni


All times are GMT -5. The time now is 11:56 AM.