// or example I have some link:

<a href='index.php?action=people'>About people</a>

// so this function will output the content of people.txt file:

if ($action=="people"){
function output() {
    $file = file("data/people.txt");
    foreach($file as $value ) {
        $output .= "$value<br>";
    }
    return $output;
}
    $content = output();
}else{
error ();
}

// How can I improve this function so, that it will work automaticly with
other links (below) too.

<a href='index.php?action=industry'>Factories</a>
<a href='index.php?action=art'>Beautiful pictures</a>
<a href='index.php?action=animals'>Zoo</a>
<a href='index.php?action=contact'>Contact us</a>

P.S.
I have tried to improve If tag and the name of .txt file this way:
if ($action=="$action"){
function output() {
    $file = file("data/".$action.".txt");

.. but the syntax is incorrect.
What to do?

Thanks,
Roman

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to