Please Help taking a PHP class can get this working right

I have been playing around with this code for awhile now. Can not get the string entered into the summary field written to the file. I have the code in 2 files.
[php]

<?php $indexfile = "index.txt"; if (isset($_REQUEST['dvd'])) { // if this is set, the user // is submitting a form to us // we should be nice and process it // first we open the index $fp = fopen($indexfile, "ab+"); fputs($fp, $_REQUEST['dvd'] . "\n"); fclose($fp); // write the summary $fp = fopen($_REQUEST['dvd'], "wb+"); fputs($fp, $_REQUEST['summary']); // add starring actors //fputs($fp, $_REQUEST['actors']); fclose($fp); echo "DVD saved."; } ?> Movie:
Summary:
<?php if (file_exists($indexfile)) { // linkify the index echo "DVD in current libary:
"; $fp = fopen($indexfile, "rb"); // for each line in the index... while ($dvd = fgets($fp)) { echo ""; echo "$dvd
"; } fclose($fp); }

$last_mod = filemtime(“index.txt”);
print("DVD Catalog last updated on ");
print(date(“m/j/y h:i”, $last_mod));
?>

[/php]

[php]<?php
$file = $_REQUEST[‘file’];
if (file_exists($file)) {
$dvd = file_get_contents($file);
echo “Summary: $summary”;
} else {
echo “No such file.”;
}
?>[/php]

I don’t see anything wrong with this code. Does the second file get created?

unless that page is the page listed in the action, it never knows that anything has been submitted. all that code on top needs to be in dvd.php.

Sponsor our Newsletter | Privacy Policy | Terms of Service