D3158 Posted February 25, 2010 Report Share Posted February 25, 2010 Content of your reminder file: <?php include "classes.php"; $orgFile = new ModFile; $orgFile->loadContent('cronpart2.txt'); $size=$orgFile->countLine(); $orgFile->displayContent(); ?> Select your options: Add a line Delete a line Modify a line Line No. to Delete/Modify: <?php for ($i=0; $i<$size; $i++) { echo "$i"; } ?> Content to Add/Modify: <?php echo "Hour"; echo ""; for ($hour=1; $hour<=24; $hour++) { echo "$hour"; } echo ""; echo "Minute"; echo ""; for ($min=0; $min<=59; $min++) { if ($min<10){ echo "$min"; } else { echo "$min"; } } echo ""; echo "Day"; echo ""; for ($day=1; $day<=31; $day++) { echo "$day"; } echo ""; echo "Month"; echo ""; for ($month=1; $month<=12; $month++) { echo "$month"; } echo ""; echo "Year"; echo ""; echo "Email"; echo ""; echo "Message"; echo ""; ?> lab6part2decision.php <?php if (!isset($_POST["doWhat"])){ die("No selection made.Back"); } $choice=$_POST["doWhat"]; include "classes.php"; $oldFile = new ModFile; $oldFile->loadContent("email.txt"); $oldFile->countLine(); switch ($choice) { case "add": if (!preg_match('/\b\d\d\d\d\b/', trim($_POST['year']))) { die("Year is not valid. Back"); } if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", trim($_POST['email']))) { die("Email is not valid. Back"); } $new=$_POST['hour'].",".$_POST['minute'].",". $_POST['day'].",".$_POST['day'].",".$_POST['month'].",". trim($_POST['year']).",".trim($_POST['email']).",".trim($_POST['message']); $oldFile->addLine($new); $oldFile->countLine(); $oldFile->writeToFile('email.txt'); break; case "delete": $lineToDelete=$_POST["chooseLine"]; $oldFile->deleteLine($lineToDelete); $oldFile->countLine(); $oldFile->writeToFile('email.txt'); break; case "modify": $lineToModify=$_POST["chooseLine"]; if (!preg_match('/\b\d\d\d\d\b/', trim($_POST['year']))) { die("Year is not valid. Back"); } if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", trim($_POST['email']))) { die("Email is not valid. Back"); } $change=$_POST['hour'].",".$_POST['minute'].",". $_POST['day'].",".$_POST['day'].",".$_POST['month'].",". trim($_POST['year']).",".trim($_POST['email']).",".trim($_POST['message']); $oldFile->modifyLine($lineToModify,$change); $oldFile->countLine(); $oldFile->writeToFile('email.txt'); break; } ?> Content of your REVISED reminder file: <?php $oldFile->countLine(); $oldFile->displayContent(); ?> Back for More Change Quote Link to comment Share on other sites More sharing options...
falkencreative Posted February 25, 2010 Report Share Posted February 25, 2010 When you try to run this code, what are you getting back? Error messages? Specifically -- what is working and what isn't? Quote Link to comment Share on other sites More sharing options...
D3158 Posted February 25, 2010 Author Report Share Posted February 25, 2010 Well for lab6part2menu.php, when I use Google Chrome it doesn't show any error. Just plain white page. But when I use Mozilla Firefox, it shows me the following. The only thing that it displays is a "Content of your reminders" and a blank table. Fatal error: Class 'ModFile' not found in /home/student/2009/cst09020/public_html/comp170/Lab6/lab6part2menu.php on line 9 For lab6part2decision.php, i see "No selection made. Go back". Go back goes back to lab6part2menu.php For classes.php, it doesn't show any error. Just plain white page. Thank you! Quote Link to comment Share on other sites More sharing options...
falkencreative Posted February 25, 2010 Report Share Posted February 25, 2010 lab6part2menu.php: You initialize your object like this: "$orgFile = new ModFile;" but it looks like your class is called "ModifyFile". Those names have to match up. lab6part2decision.php: This file only works if you have accessed the lab6part2menu.php file and submitted the form. Otherwise, it will generate the "No selection made" text. Fix the issue above with lab6part2menu.php and then try this again. classes.php: This file includes the code for your ModifyFile class. It won't show anything in the browser when you view it, so a plain white page is normal. Quote Link to comment Share on other sites More sharing options...
D3158 Posted February 25, 2010 Author Report Share Posted February 25, 2010 (edited) That kind of helped. It displayed the text below the table like this: Select your option: Radio button: Add Radio button: Modify Radio button: Delete Line No. to Delete/Modify = dropdown (doesnt have any values to it... I am assuming it's because the content within the table isn't shown which is indicated by line number 1 to 10 or something.. BUT it has this mean thing: Notice: Undefined variable: arrayContent in /home/..../..../..../public_html/..../Lab6/classes.php on line 89) Content to Add/Modify = Hrs [Dropdown from 1:00-24:00] Mins[Dropdown from 1:00-59:00] Day [Dropdown from 1-31] Month[Dropdown from 1-12] Year [Whatever year user wants to input] E-mail[Whatever email user wants to input] Message[Whatever message user wants to input] SUBMIT RESET Thanks! Edited February 25, 2010 by D3158 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.