0

i need to know how to make a php page dynamically create other pages using ".htaccess" file , i know the way to dynamically create pages using "PHP" but some problems face me when i try to create this new pages.

<?php
    foreach ($group as $key => $value) {
        $myfile = "editpage-$key.php";
        $fh = fopen($myfile, 'w');
        $stringdata = '
        <?php

$group = array(
    "0" => array("name"=>"Ahmed" , "age"=>"21" ,  "school"=>"Ahmed School"),
    "1" => array("name"=>"Mahmud" , "age"=>"22" ,  "school"=>"Mahmud School"),
    "2" => array("name"=>"Israa" , "age"=>"23" ,  "school"=>"Israa School"),
    "3" => array("name"=>"Lamiaa" , "age"=>"24" ,  "school"=>"Lamiaa School"),
    "4" => array("name"=>"Marwa" , "age"=>"25" ,  "school"=>"Marwa School"),
    "5" => array("name"=>"Amr" , "age"=>"22" ,  "school"=>"Amr School"),
    "6" => array("name"=>"Hassan" , "age"=>"23" ,  "school"=>"Hassan School"),
    "7" => array("name"=>"Osama" , "age"=>"25" ,  "school"=>"Osama School") );
    echo "name is ".$group[0]["name"];
?>

        <!DOCTYPE html>
        <html>
        <head>
        <title>Edit Page</title>
            <style>
    #header {
        height :170px;
        width : 100%;
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
mahmudy-91
  • 81
  • 1
  • 10
  • 1
    Dynamically create other pages? – Jay Blanchard Mar 17 '17 at 15:18
  • yes but using .htaccess file ,i know how to make it using php but some problems face me – mahmudy-91 Mar 17 '17 at 15:19
  • What exactly you are trying to achieve. – BugHunter Mar 17 '17 at 15:20
  • nothing about this piece of code i just added it to show that i know that in php but how to make it using .htaccess – mahmudy-91 Mar 17 '17 at 15:21
  • 1
    How to make what with PHP? And what is your above code actually doing? I can only see that you're creating a string and then output some html. Btw, you don't use htaccess to "create" anything. – M. Eriksson Mar 17 '17 at 15:21
  • 1. there is little sense in creating "dynamic pages" by creating physical files on the server side. That is better done using dynamic content generation. 2. you will have to state _what_ problems you face with the usage of dynamic configuration files (`.htaccess`). Such files are not "creating" anything, they control access to existing resources. – arkascha Mar 17 '17 at 15:22
  • http://stackoverflow.com/questions/14871014/how-to-generate-a-html-page-dynamically-using-php i found in that question someone saying it can be done using htaccess file – mahmudy-91 Mar 17 '17 at 15:25
  • Possible duplicate of [How to generate a HTML page dynamically using PHP?](http://stackoverflow.com/questions/14871014/how-to-generate-a-html-page-dynamically-using-php) – Kuldeep Singh Mar 17 '17 at 15:27
  • 2
    You did not understand what the answer in that question tries to express. You just say the words "`.htaccess`" and "create" and "page"... – arkascha Mar 17 '17 at 15:27

0 Answers0