I need some help with a slight problem I'm having getting my data to display
to the correct page. What I'm trying to do is allow users to post data to
some pages on my site and make that data available for viewing.
So far I have it so that I can connect to the db and post the data to the
table. I can even display that data. The problem is that the data isn't
posting like it should. If userA post a poem to the poetry page, that data
should only display on the poetry page. If userB post an essay to the Essay
page, then that data is only displayed in the Essays section. Right now the
data is showing up on all pages. So userA's poem shows up in both the Poetry
& Essay pages.
Here's the code that I'm using:
<?php
 // If the user wants to add a file
 if (isset($addfile)):
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Enter your Essay here:</P><BR>
<TEXTAREA NAME="Filedata" ROWS=20 COLS=70 WRAP>
<CENTER><b> ENTER YOUR TITLE HERE </B></CENTER>
<P> START TYPING YOUR POEM HERE </P><BR>
</TEXTAREA><BR>
<INPUT TYPE=SUBMIT NAME="submitform" VALUE="SUBMIT">
<input type="reset" name="clear" value="Clear">
</FORM></FONT>

<font face="verdana, arial, helvetica" size="1">
<?php
 else:
    // Connect to the database server
    $dbcnx = @mysql_connect("localhost",
        "dbnubiint_user", "dbusernu");
 if (!$dbcnx) {
   echo( "<P>Unable to connect to the " .
        "database server at this time.</P>" );
 exit();
}
   // Select the dbnubiint database
   if (! @mysql_select_db("dbnubiint") ) {
        echo( "<P>Unable to locate the file " .
          "database at this time.</P>" );
 exit();
}
    // If a file has been submitted,
    // add it to the database.
    if ("SUBMIT" == $submitform) {
        $sql = "INSERT INTO nuwoez SET " .
           "Filedata='$Filedata', " .
           "Filetype='$Filetype', " .
           "Author='$Author', " .
           "City='$City', " .
           "State='$State', " .
           "Email='$Email', " .
           "Title='$Title', " .
           "Copyright='$Copyright', " .
           "Category='$Category', " .
           "Submitdate=CURDATE()";
        if (mysql_query($sql)) {
          echo("<P>Thank You, Your work has been submitted.</P>");
        } else {
          echo("<P>Error adding submitted file: " .
                mysql_error() . "</P>");
 }
}
echo("<P> Here are all the files " .
        "in our database: </P>");

    // Request the text of all the files
    $result = mysql_query(
        "SELECT Filedata FROM nuwoez");
    if (!$result) {
      echo("<P>Error performing query: " .
            mysql_error() . "</P>");
      exit();
    }
    // Display the text of each file in a paragraph
    while ( $row = mysql_fetch_array($result) ) {
      echo("<P>" . $row["Filedata"] . "</P>");
    }
    // When clicked, this link will load this page
    // with the file submission form displayed.
    echo("<P><A HREF='$PHP_SELF?addfile=1'>" .
        "Click to Submit a Poem!</A></P>");
  endif;
?>

Also how can I get the data entered into the text fields to display when
submitted?
TIA
Any response on this is appreciated.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to