Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Your Message

Click here to log in

What is the number after 87?

 
 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Rate Thread

You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.

Topic Review (Newest First)

  • 12-11-2010, 04:10 AM
    Sam

    I have a PHP assignment due and I cannot figure out 1 error. Please Help!!?

    This is supposed to return the information saved in a .txt. file, but it won't work with this error. The error comes up on the closing </body> tag and I don't know why. Can anyone tell me what the error is?
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>My Contacts</title>
    </head>

    <body>
    <h1> My Contacts</h1>
    <p align="center">Display the data!</p>
    </form>
    <?php
    if (!file_exists("info.txt") || filesize("info.txt") == 0)
    echo "<p>There are no contacts registered.</p>";// if no info entered
    else {
    $contactsArray= file("info.txt");
    sort($contactsArray);
    $NameCount= 0;
    echo "<table>";
    foreach($contactsArray as $record) {
    $contact = explode(",",",",",", $record);
    echo "<p><tr>";
    echo "<td><strong>" . (++$NameCount) . "</strong>.</td>";
    echo "<td><strong>Last Name</strong>: ". $Last[0] . "<br/>";
    echo "<strong>First Name</strong>: " . $First[1] . "<br/>";
    echo "<strong>Address</strong>: " . $Address[2] . "<br/>";
    echo "<strong>City</strong>: " . $City[3] . "<br/>";
    echo "<strong>State</strong>: " . $State[4] . "<br/>";
    echo "<strong>Zip Code</strong>: " . $Zip[5] . "<br/>";
    echo "<strong>Area Code $ Phone Number</strong>: " . $Phone[6] . "<br/>";
    echo "</td></tr></p>";
    }//end foreach
    echo"</table>"
    ?>
    </body>
    </html>
    OOPS. the form is all there now, but the error is still there. I cannot figure this out!!!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>My Contacts</title>
    </head>

    <body>
    <h1> My Contacts</h1>
    <p align="center">Display the data!</p>
    <form action="readfile.php" method="get">
    <input type='submit' />
    </form>
    <?php
    if (!file_exists("info.txt") || filesize("info.txt") == 0)
    echo "<p>There are no contacts registered.</p>";// if no info entered
    else
    $contactsArray= file("info.txt");
    sort($contactsArray);
    $NameCount= 0;{
    echo "<table>";
    foreach ($contactsArray as $record) {
    $contact = explode(",",",",",", $record);
    echo "<p><tr>";
    echo "<td><strong>" . (++$NameCount) . "</strong>.</td>";
    echo "<td><strong>Last Name</strong>: ". $Last[0] . "<br/>";
    echo "<strong>First Name</strong>: " . $Fir

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •