coding php for class
Posted: Thu Mar 06, 2014 7:22 am
ok here is my problem
we are making a sign up form for a guest book well here is the break down
Signup Forum Guestbook
Name added (shows the current user that just signed up)
View Guest book
now here is my problem in the view guest book i have to make a link that sorts the guestbook in ascending order and descending and then have a button that you can enter the row you want to delete and then press the delete button and it goes back to the list but deletes it
well here is the teachers sample
http://www.eiu-mis.net/samples/proj3/GuestBook.html
and here is mine
http://4530ceevulukwu.eiu-mis.net/Project3.php
it would be better if you go through the sample and mine to see what i am doing wrong
we are making a sign up form for a guest book well here is the break down
Signup Forum Guestbook
Name added (shows the current user that just signed up)
Code: Select all
<?php
$name = ($_POST['name']);
$email = ($_POST['email']);
$guestbook = fopen("guestbook.txt", "ab");
if (is_writeable("guestbook.txt")) {
if (fwrite($guestbook, $name.", ".$email . "\n"))
echo
"<h1>Name Added</h1><br />",
"<p><strong>Name</strong>:", $name, "<br /><strong>E-mail</strong>:", $email, "</p></form><br />";
else
echo "<p>Cannot add your name to the guest book.</p>\n";
}
else
echo"<p> cannot write to the file.</p>\n";
fclose($guestbook);
?>Code: Select all
<?php
echo "<h1>Visitors</h1><br />";
$viewgb = file("guestbook.txt");
for ($i=0; $i<count($viewgb); ++$i) {
$visitors = explode(", ", $viewgb[$i]);
sort($visitors);
echo ($i+1)," <strong>Name:</strong>", $visitors[0], "<br />";
echo "<strong>Email:</strong>",$visitors[1],"<br />";
echo "<hr />";
}
?>well here is the teachers sample
http://www.eiu-mis.net/samples/proj3/GuestBook.html
and here is mine
http://4530ceevulukwu.eiu-mis.net/Project3.php
it would be better if you go through the sample and mine to see what i am doing wrong