i.e. (my readdir loop will return 3 form elements):
Code: Select all
<form action="somefile.php">
<input type="hidden" name="file[]" value="<?=$file?>">
<!--user input -->
<textarea name="keywords[]" cols="75" rows="5"></textarea>
<textarea name="description[]" cols="75" rows="5"></textarea>
<input type="submit" name="Submit" value="Go">
<!--user input -->
<input type="hidden" name="file[]" value="<?=$file?>">
<!--user input -->
<textarea name="keywords[]" cols="75" rows="5"></textarea>
<textarea name="description[]" cols="75" rows="5"></textarea>
<input type="submit" name="Submit" value="Go">
<!--user input -->
<input type="hidden" name="file[]" value="<?=$file?>">
<!--user input -->
<textarea name="keywords[]" cols="75" rows="5"></textarea>
<textarea name="description[]" cols="75" rows="5"></textarea>
<input type="submit" name="Submit" value="Go">
<!--user input -->
</form>
My "somefile.php" file will create another page, let's call "include.php," using fopen with a final goal of writing a switch function to "include.php" so that "include.php" looks something like this:
Code: Select all
<?
switch($_GET['do']){
case '1':
$keywords = '1's keywords';
$description = '1's description';
break;
case '2':
$keywords = '2's keywords';
$description = '2's description';
break;
case '3':
$keywords = '3's keywords';
$description = '3's description';
break;
}
Here's where I am hung up...
In "somefile.php" I am working with a foreach function to get the $_POST['file'], $_POST['keywords'], and $_POST['description'] for each form element so as to format it to look like this:
Code: Select all
<?
$fp = fopen('', w);
fwrite($fp, '<?');
fwrite($fp, "\n");
fwrite($fp, 'switch(\$_GET['do']');
fwrite($fp, "\n");
fwrite($fp, "case '1':");
fwrite($fp, "\n");
fwrite($fp, "\$keywords = '1's keywords';");
...
...
etc...
fclose($fp);
?>
Thanks! Dan