2 messages in com.mysql.lists.win32Newbie seeking help creating form to ...| From | Sent On | Attachments |
|---|---|---|
| Marvin Cummings | 16 Sep 2002 22:48 | |
| Ignatius Reilly | 16 Sep 2002 23:21 |
| Subject: | Newbie seeking help creating form to allow users to add files to database![]() |
|---|---|
| From: | Marvin Cummings (mar...@bellsouth.net) |
| Date: | 09/16/2002 10:48:38 PM |
| List: | com.mysql.lists.win32 |
I'm having a problem getting data entered into my database to show up in the database. Instead it wants to show up in the form. Can someone advise me on how to troubleshoot this? The form is located at www.nubiint.com/nuwoez/submitform.php and also at www.nubiint.com/nuwoez/nuwoez.htm. The top of the submitform shows what happened after I added some data into the text field. The Essays section shows a sample of what happened after adding the text that was supposed to be stored in the database. For some reason the data that I enter ends up on the submit form instead of in the database. Here's a sample of the code from the submitform.php file: <html> <head> <title>nuWoEz Submit Form</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <form enctype="multipart/form-data" name="frmUploadFile" action="submitform.php" method="post"> <!---Body---> <body bgcolor="#ededed" text="#000000" id="all" leftmargin="10" topmargin="0" marginwidth="10" marginheight="10" link="#000020" vlink="#000020" alink="#000020">
<?php // If the user wants to add a file if (isset($addfile)): ?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST> <P>Enter your work here:<BR> <TEXTAREA NAME="Filedata" ROWS=10 COLS=40 WRAP> </TEXTAREA><BR> <INPUT TYPE=SUBMIT NAME="submitform" VALUE="SUBMIT"> </FORM>
<?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', " . "Category='$Category', " . "Filename='$Filename', " . "Submitdate=CURDATE()"; if (mysql_query($sql)) { echo("<P>Your file has been added.</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'>" . "Add a File!</A></P>"); endif; ?> <font face="Verdana" size="2" color="#000000"> <Center><h4><b>WoEz Submission Form</b></h4></center></font> <div align="left"> <p><font face="Verdana" size="2">The form below serves as a method for submitting any of your poems, essays, or short stories to the nuWoEz @ Nubiint.com web page. Please pay close attention to the rules listed below as they govern how your work is captured, uploaded, and stored into the Nubiint community database.</font></p> <p><font face="Verdana" size="2">To use this form please observe the following:<br> 1). Please enter all of the information listed below. The database is configured to store files according to this information. Refusal to add this basic information could make it hard for your work to be searched and viewed by members of the community.<br> 2). Please note that the maximum amount of characters that can be added into each of the fields below is 40, and 2 characters is the max for the "State" field.<br> 3). Please note that the maximum file size that can be uploaded into the database is 2MB. Anything larger than that will be rejected and therefore should be emailed to the webkeeper for proper formatting and to be added manually. You can determine the size of your file by viewing its properties.<br> 4). Currently only "one" submission is allowed at a time. This will change in time if the amount of frequent uploads demand it. You're more than welcome to click "back" to submit more of your work.<br> 5). Please be sure to select the correct category for your work from the drop-down menu. This is very important because it helps to keep the pages updated with the proper content for the right section. It also maintains a sense of unity and order for those selecting to browse and/or view your work. <br> 6). Anything that's uploaded to the database goes directly to the database. This ensures it's displayed as it's meant to be displayed. Therefore you should take the time and format your work in such a way that it reflects what you want it to say.<br> </font> <br> </p> </div> <center> <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="65%"> <font face="verdana, arial, helvetica" size="1" color="#000000"><font face="verdana, arial, helvetica" size="2" > <tr> <td width="65%" bgcolor="#481616" height="22" colspan="2"> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> <Center><b>Enter Your Information Below</b></center></font></b></td> </tr> </font></font> </table>
<!---Enter User Info---> <table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="65%"> <tr> <td width="100%" bgcolor="#f4f1ed" colspan="2"> <table border=0 cellpadding=2 cellspacing=2> <tr> <td><font face="Verdana" size="2">Author</font></td> <td> <input type="text" size="40" maxsize="40" name="name" maxlength="40"> </td> </tr> <tr> <td><font face="Verdana" size="2">City</font></td> <td> <input type="text" size="40" maxsize="40" name="add1" maxlength="40"> </td> </tr> <tr> <td><font face="Verdana" size="2">State</font></td> <td> <input type="text" size="40" maxsize="40" name="add1" maxlength="2"> </td> </tr> <tr> <td><font face="Verdana" size="2">Email</font></td> <td> <input type="text" size="40" maxsize="40" name="email" maxlength="40"> </td> </tr> <tr> <td><font face="Verdana" size="2">Title</font></td> <td> <input type="text" size="40" maxsize="40" name="title" maxlength="100"> </td> </tr> <tr> <td><font face="Verdana" size="2">Copyright Date</font></td> <td> <input type="text" size="40" maxsize="40" name="date"> </td> </tr> <tr> <td><font face="Verdana" size="2">Submit Date</font></td> <td> <input type="text" size="40" maxsize="40" name="date"> </td> </tr> <td><font face="Verdana" size="2">Submit Category:</font></td> <td> <select name="type"> <option selected>Essays </option> <option>Fiction </option> <option>HDA </option> <option>Interpretationz </option> <option>Poetry </option> <option>Short Stories </option> <option>Topz </option> </select> </td> </tr> </table></table> </center> <br> <!---Upload File Form---> <center> <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="65%"> <font face="verdana, arial, helvetica" size="1" color="#000000"><font face="verdana, arial, helvetica" size="2" > <tr> <td width="65%" bgcolor="#481616" height="22" colspan="2"> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> <Center> <b>Upload Your File Below</b> </center></font></b></td> </tr> </font></font> </table> <!---End of User Info---> <!---Submit Table--> <table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="65%"> <tr> <td width="100%" bgcolor="#f4f1ed" colspan="2"> <table border=0 cellpadding=2 cellspacing=2> <tr> <td><font face="Verdana" size="2">File Name</font></td> <td> <input type="text" size="40" maxsize="40" name="fname" maxlength="100"> </td> </tr> <tr> <td><font face="Verdana" size="2">File Location</font></td> <td> <input type="file" name="file" maxlength="40"> </td> </tr> <tr> <td> </td> <td> <div align="left"> <input type="submit" name="upload" value="Upload"> <input type="reset" name="clear" value="Clear"> </div> </td> </tr> <tr> <td> </td> <td> <div align="left"></div> </td> </table></table> </center> <br> <!---Sumit FileData Form--> <center> <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="65%"> <font face="verdana, arial, helvetica" size="1" color="#000000"><font face="verdana, arial, helvetica" size="2" > <tr> <td width="65%" bgcolor="#481616" height="22" colspan="2"> <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF"> <Center> <b>Enter and Click to Submit Work</b> </center></font></b></td> </tr> </font></font> </table> </center> <center> <TEXTAREA NAME="filedata" rows="20" cols="55" WRAP> </TEXTAREA><BR> <INPUT TYPE=SUBMIT NAME="filedata" VALUE="Submit"> <input type=reset name="clear" value="Clear"> </center><br> <br> <br> <br> <br> <div class footer="footer"> <center> <font face="verdana,arial,helvetica" size="1" class="sf"> <p>©2002 Nubiint.com. Nubian Internet Intertainment. nuWoEz. All quotes, images, and text. All rights reserved.<br> Broken links? Contact:<a href="mailto:webk...@nubiint.com?subject=BrokenLinks%20webkeeper"> WebK...@nubiint.com<br></a></p></font></center></div> </form> </body> </html>




