I am new to PHP and I am having some problems and I am hoping someone can point me in the right direction. Here is what I need to do:

Create a Web Form for uploading pictures for a high school reunion. The form should have text input fields for the person's name and a description of the image, and a file input field for the image. To accompany each file, create a text file that contains the name and description of the image. Create a separate Web Page that displays the pictures with a caption showing the name and description fields. Make sure the folder has read and write for everyone.

Here is what I have but it isnt working properly:

  • Process page of the page!
  • an errow here: This is the message I get!
    Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR) in C:\ITEC315\htdocs\users\ramojumder0\Reinforcement Exercises\Ch. 5\R.E.5-5_FillPictureForm.php on line 28 which deals with the picture!

    • My problem is that it is having a problem uploading a picture and showing it!

    • How do I fix the issue with uploading a picture and then showing it!

    <?php

    if (empty($_POST['name']) || empty($_POST['description']))

    echo "<p>You must enter your name and description about
         your picture. Click your browser's Back button 
         to return to the Picture Input Page!</p>\n";
    

    else {
    $Name = addslashes($_POST['name']);
    $Description = addslashes($_POST['description']);
    $Picture = addslashes($_POST['picture']);
    $ShowPic = fopen("showpic.txt", "ab");
    if (is_writeable("showpic.txt)) {
    if (fwrite($ShowPic, $Name . "," . $Description . "," .
    $Picture . "\r\n"))
    echo "<p>Thank you for filling out the Picture Input Page!</p>\n";
    else
    echo "<p>Cannot add your name to the Picture Input Page!</p>\n";
    }

    else 
        echo "<p>Cannot write to the file.</p>\n";
    fclose($ShowPic);
    }
    

    ?><!--End PHP Script-->

    • Input page of the program!

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>
    <title>Exercise 5-5</title>
    </head>
    <body>

    <h2>Exercise 5-5: Picture Input Page!</h2>

    <form method="POST" action="R.E.5-5_FillPictureForm.php">

    <p>Name <input type="text" name="name"
    /></p>
    <p>Description <input type="text" name="description"
    /></p>
    <p>Choose a file to upload: <input type = "file" name = "picture" accept = "image/*"
    /></p>
    <p><input type="submit" value="Submit" /></p>
    </form>
    <p><a href="R.E.5-5_ShowPictures.php">Show Pictures
    </a></p>

    </body>

    </html>

& Show picture part of the program

<?php


readfile("showpic.txt");




?><!--End PHP Script-->
 i think you have to put this "R.E.5-5_ShowPictures.php" in php tags.
like this 
 <p><a href="<?php R.E.5-5_ShowPictures.php ?>">Show Pictures</a></p>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.