Jump to content

melissal

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

melissal's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I have a date coming from a database. It's in the format YYYYMMDD, ie. 20090409. I need to turn it into this format: Thursday, April 9, 2009. Is there an easy way of doing this?
  2. If I have a variable which will give me a date in this format: 31/12/2007 or 31/1/2008, etc, Is there way to be able to tell which day of the week it will be?
  3. So I'm trying to build a basic shopping cart product page, wherein the the user can select put a date into a form and that date gets passed into the URL after which it gets put into the session for the specific cart item. The trouble that I'm having is putting it into the URL in the first place along with the other variables that I need. Here's my code...I know I'm doing something wrong but I'm not sure how to fix it... <form action="reserve.php" method="get"> Date Requested: <input name="reservation_date" id="reservation_date" type="text" value="dd/mm/yy"> </form> <?php echo "<center> <a href='reserve.php?reservation_date=".$_GET['reservation_date']."&category_id=$category_id&product_id=".$_GET['product_id']."'> <img src='images/reserve_button.gif' border='0'></a></center>
  4. Sorry to be stupid, but how/where would I do that?
  5. Can someone help me with this? Everything else goes into the database fine, except for: product_image (the filename) product_size (the size of the image) product_type (the type of image) [code]<?php // This page allows users to upload files to the server. // Check to see if the user is signed in if (isset($_SESSION['artist_id'])) {   $counter = 1; // Number of files to allow for.     if (isset($_POST['submitted'])) { // Handle the form.         //require_once ('../mysql_connect.php'); // Connect to the database.             for ($i = 0; $i < $counter; $i++) { // Handle each uploaded file.               // Create index names to refer to the proper upload and description.         $filename = 'product' . ($i+1);         //$description = 'description' . $i;               // Check for a file.         if (isset($_FILES[$filename]) && ($_FILES[$filename]['error'] != 4)) {                         // Add the record to the database.             $query = "INSERT INTO products (product_image, product_imagesize, product_imagetype, product_ipaddress, product_date, product_artist_id, product_title, product_shortdescription, product_description, product_price, product_size, product_approved, product_featured) VALUES ('{$_FILES[$filename]['name']}', {$_FILES[$filename]['size']}, '{$_FILES[$filename]['type']}', '".$_SERVER['REMOTE_ADDR']."', NOW(), '".$_SESSION['artist_id']."','".$_POST['product_title']."','".$_POST['product_shortdescription']."','".$_POST['product_description']."','".$_POST['product_price']."','".$_POST['product_size']."','n','n')";             $result = mysql_query ($query) or die('failed to add product to database' . mysql_error());                     if ($result) {                             // Return the product_id from the database.               $product_id = mysql_insert_id();                                           // Move the file over.               if (move_uploaded_file($_FILES[$filename]['tmp_name'], "uploads/$product_id-{$_FILES[$filename]['name']}")) {                                 echo '<p>File number ' . ($i + 1) . ' has been uploaded!</p>';                                 } else { // File could not be moved.                                 echo '<p><font color="red">File number ' . ($i + 1) . ' could not be moved.</font></p>';                           // Remove the record from the database.                   $query = "DELETE FROM products WHERE product_id = $product_id";                   $result = mysql_query ($query);                                     // Add more detailed error reporting, if desired.                                 }                           } else { // If the query did not run OK.               echo '<p><font color="red">Your submission could not be processed due to a system error. We apologize for any inconvenience!</font></p>';               // Print the query and invoke the mysql_error() function to debug.             }                     } else {             // no file was uploaded             $query = "INSERT INTO products (product_image, product_imagesize, product_imagetype, product_ipaddress, product_date, product_artist_id, product_title, product_shortdescription, product_description, product_price, product_size, product_approved, product_featured) VALUES ('', 0, '', '".$_SERVER['REMOTE_ADDR']."', NOW(), '".$_SESSION['artist_id']."','".$_POST['product_title']."','".$_POST['product_shortdescription']."','".$_POST['product_description']."','".$_POST['product_price']."','".$_POST['product_size']."','n','n')";                         $result = mysql_query ($query);                     if (!$result) {               echo '<p><font color="red">Your submission could not be processed due to a system error. We apologize for any inconvenience!</font></p>';             } else {               echo '<p>Product has been successfully uploaded!</p>';             }         }// End of if (isset($the_file)...               } // End of FOR loop.             mysql_close(); // Close the database connection.           } // End of the main Submit conditional.   ?>                           <div class="titletext">Add a product</div><br />   <form enctype="multipart/form-data" action="product_add.php" method="post">       <input type="hidden" name="MAX_FILE_SIZE" value="524288">             <?php // Create the inputs.       for ($i = 0; $i < $counter; $i++) {         ?>                     <table>               <tr>                   <td width="120"><font color="#FF0033">*</font>Title/Name:</td>                   <td width="200"><input type="text" name="product_title" size="30" maxlength="50" /></td>               </tr>               <tr>                   <td width="120"><font color="#FF0033">*</font>Short Description:</td>                   <td width="200"><textarea name="product_shortdescription" cols="23" rows="2"></textarea></td>               </tr>               <tr>                   <td width="120"><font color="#FF0033">*</font>Description:</td>                   <td width="200"><textarea name="product_description" cols="23" rows="5"></textarea></td>               </tr>                          <tr>                   <td width="120"><font color="#FF0033">*</font>Price:</td>                   <td width="200"><input type="text" name="product_price" size="30" maxlength="10" /></td>               </tr>               <tr>                   <td width="120"><font color="#FF0033">*</font>Size:</td>                   <td width="200"><input type="text" name="product_size" size="30" maxlength="20" /></td>               </tr>               <tr>                   <td width="120">Image:</td>                   <td width="200"><input type="file" name="product1" /></td>               </tr>               </table>       <?php             }       ?>             <input type="hidden" name="submitted" value="TRUE" />       <div align="center"><input type="submit" name="submit" value="Submit" /></div>     </form> <?php }else{   echo "<a href='login.php'>Please Login</a>"; } ?>[/code]
  6. I've put the following code into a site...It allows users to add a product, and an image. The problem with it is that if they don't put an image in, nothing happens....It works great if they browse for an image, and click submit, but i need the image field to be optional. Can anyone help? [code]<?php     include('require.php');     include('include/HTML_header.php'); ?> <table id="table_main" class="table_main">     <tr>         <td colspan="4">             <?php include('include/header.php'); ?>         </td>     </tr>     <tr>         <td id="table_left" width="150px" align="left">             <?php category_list_by_price(); ?><br />             <?php category_list(); ?><br />             <?php searchform(); ?>         </td>         <td width="20px">&nbsp;</td>         <td id="table_content" width="560px" align="left">          <!-----------------------------------THE CONTENT GOES BELOW THIS LINE-----------------------------------> <?php // This page allows users to upload files to the server. $counter = 1; // Number of files to allow for. if (isset($_POST['submitted'])) { // Handle the form.     //require_once ('../mysql_connect.php'); // Connect to the database.          for ($i = 0; $i < $counter; $i++) { // Handle each uploaded file.              // Create index names to refer to the proper upload and description.         $filename = 'product' . $i;         //$description = 'description' . $i;              // Check for a file.         if (isset($_FILES[$filename]) && ($_FILES[$filename]['error'] != 4)) {             // Check for a description (not required).             /*if (!empty($_POST[$description])) {                 $d = "'" . escape_data($_POST[$description]) . "'";             } else {                 $d = 'NULL';             }*/                          // Add the record to the database.             $query = "INSERT INTO products (product_file_name, product_file_size, product_file_type, product_ipaddress,product_date,product_user_id,product_title,product_description,product_category_id,product_price_id,product_price,product_image) VALUES ('{$_FILES[$filename]['name']}', {$_FILES[$filename]['size']}, '{$_FILES[$filename]['type']}', '".$_SERVER['REMOTE_ADDR']."', NOW(), '".$_SESSION['user_id']."','".$_POST['product_title']."','".$_POST['product_description']."','".$_POST['product_category_id']."','".$_POST['product_price_id']."','".$_POST['product_price']."','{$_FILES[$filename]['name']}')";             $result = mysql_query ($query);                      if ($result) {                                  // Return the product_id from the database.                 $product_id = mysql_insert_id();                                                   // Move the file over.                 if (move_uploaded_file($_FILES[$filename]['tmp_name'], "../uploads/$product_id-{$_FILES[$filename]['name']}")) {                                      echo '<p>File number ' . ($i + 1) . ' has been uploaded!</p>';                                      } else { // File could not be moved.                                      echo '<p><font color="red">File number ' . ($i + 1) . ' could not be moved.</font></p>';                              // Remove the record from the database.                     $query = "DELETE FROM products WHERE product_id = $product_id";                     $result = mysql_query ($query);                                          // Add more detailed error reporting, if desired.                                      }                              } else { // If the query did not run OK.                 echo '<p><font color="red">Your submission could not be processed due to a system error. We apologize for any inconvenience!</font></p>';                 // Print the query and invoke the mysql_error() function to debug.             }                      } // End of if (isset($the_file)...              } // End of FOR loop.          mysql_close(); // Close the database connection.          } // End of the main Submit conditional. ?> <div class="titletext">Add a Product</div><br /> <form enctype="multipart/form-data" action="product_add-working.php" method="post">     <input type="hidden" name="MAX_FILE_SIZE" value="524288">          <?php // Create the inputs.     for ($i = 0; $i < $counter; $i++) {         echo '                      <table>                 <tr>                     <td width="120"><font color="#FF0033">*</font>Product Title/Name:</td>                     <td width="200"><input type="text" name="product_title" size="30" maxlength="50" /></td>                 </tr>                 <tr>                     <td width="120"><font color="#FF0033">*</font>Description:</td>                     <td width="200"><textarea name="product_description" cols="23" rows="5"></textarea></td>                 </tr>                 <tr>                     <td width="120"><font color="#FF0033">*</font>Category:</td>                     <td width="200"><input type="text" name="product_category_id" size="30" maxlength="50" /></td>                 </tr>                 <tr>                     <td width="120"><font color="#FF0033">*</font>Price:</td>                     <td width="200"><input type="text" name="product_price_id" size="30" maxlength="50" /></td>                 </tr>                 <tr>                     <td width="120">Price:</td>                     <td width="200"><input type="text" name="product_price" size="30" maxlength="50" /></td>                 </tr>                 <tr>                     <td width="120">Image:</td>                     <td width="200"><input type="file" name="product' . $i . '" /></td>                 </tr>              </table>          ';     }     ?>          <input type="hidden" name="submitted" value="TRUE" />     <div align="center"><input type="submit" name="submit" value="Submit" /></div> </form> <!-----------------------------------THE CONTENT GOES ABOVE THIS LINE----------------------------------->                 </td>         <td width="20px">&nbsp;</td>     </tr> </table> <?php include('include/loginfooter2.php'); ?>[/code]
  7. I've put the following code into a site...It allows users to add a product, and an image. The problem with it is that if they don't put an image in, nothing happens....It works great if they browse for an image, and click submit, but i need the image field to be optional. Can anyone help? [code]<?php     include('require.php');     include('include/HTML_header.php'); ?> <table id="table_main" class="table_main">     <tr>         <td colspan="4">             <?php include('include/header.php'); ?>         </td>     </tr>     <tr>         <td id="table_left" width="150px" align="left">             <?php category_list_by_price(); ?><br />             <?php category_list(); ?><br />             <?php searchform(); ?>         </td>         <td width="20px">&nbsp;</td>         <td id="table_content" width="560px" align="left">          <!-----------------------------------THE CONTENT GOES BELOW THIS LINE-----------------------------------> <?php // This page allows users to upload files to the server. $counter = 1; // Number of files to allow for. if (isset($_POST['submitted'])) { // Handle the form.     //require_once ('../mysql_connect.php'); // Connect to the database.          for ($i = 0; $i < $counter; $i++) { // Handle each uploaded file.              // Create index names to refer to the proper upload and description.         $filename = 'product' . $i;         //$description = 'description' . $i;              // Check for a file.         if (isset($_FILES[$filename]) && ($_FILES[$filename]['error'] != 4)) {             // Check for a description (not required).             /*if (!empty($_POST[$description])) {                 $d = "'" . escape_data($_POST[$description]) . "'";             } else {                 $d = 'NULL';             }*/                          // Add the record to the database.             $query = "INSERT INTO products (product_file_name, product_file_size, product_file_type, product_ipaddress,product_date,product_user_id,product_title,product_description,product_category_id,product_price_id,product_price) VALUES ('{$_FILES[$filename]['name']}', {$_FILES[$filename]['size']}, '{$_FILES[$filename]['type']}', '".$_SERVER['REMOTE_ADDR']."', NOW(), '".$_SESSION['user_id']."','".$_POST['product_title']."','".$_POST['product_description']."','".$_POST['product_category_id']."','".$_POST['product_price_id']."','".$_POST['product_price']."')";             $result = mysql_query ($query);                      if ($result) {                                  // Return the product_id from the database.                 $product_id = mysql_insert_id();                                                   // Move the file over.                 if (move_uploaded_file($_FILES[$filename]['tmp_name'], "../uploads/$product_id-{$_FILES[$filename]['name']}")) {                                      echo '<p>File number ' . ($i + 1) . ' has been uploaded!</p>';                                      } else { // File could not be moved.                                      echo '<p><font color="red">File number ' . ($i + 1) . ' could not be moved.</font></p>';                              // Remove the record from the database.                     $query = "DELETE FROM products WHERE product_id = $product_id";                     $result = mysql_query ($query);                                          // Add more detailed error reporting, if desired.                                      }                              } else { // If the query did not run OK.                 echo '<p><font color="red">Your submission could not be processed due to a system error. We apologize for any inconvenience!</font></p>';                 // Print the query and invoke the mysql_error() function to debug.             }                      } // End of if (isset($the_file)...              } // End of FOR loop.          mysql_close(); // Close the database connection.          } // End of the main Submit conditional. ?> <div class="titletext">Add a Product</div><br /> <form enctype="multipart/form-data" action="product_add-working.php" method="post">     <input type="hidden" name="MAX_FILE_SIZE" value="524288">          <?php // Create the inputs.     for ($i = 0; $i < $counter; $i++) {         echo '                      <table>                 <tr>                     <td width="120"><font color="#FF0033">*</font>Product Title/Name:</td>                     <td width="200"><input type="text" name="product_title" size="30" maxlength="50" /></td>                 </tr>                 <tr>                     <td width="120"><font color="#FF0033">*</font>Description:</td>                     <td width="200"><textarea name="product_description" cols="23" rows="5"></textarea></td>                 </tr>                 <tr>                     <td width="120"><font color="#FF0033">*</font>Category:</td>                     <td width="200"><input type="text" name="product_category_id" size="30" maxlength="50" /></td>                 </tr>                 <tr>                     <td width="120"><font color="#FF0033">*</font>Price:</td>                     <td width="200"><input type="text" name="product_price_id" size="30" maxlength="50" /></td>                 </tr>                 <tr>                     <td width="120">Price:</td>                     <td width="200"><input type="text" name="product_price" size="30" maxlength="50" /></td>                 </tr>                 <tr>                     <td width="120">Image:</td>                     <td width="200"><input type="file" name="product' . $i . '" /></td>                 </tr>              </table>          ';     }     ?>          <input type="hidden" name="submitted" value="TRUE" />     <div align="center"><input type="submit" name="submit" value="Submit" /></div> </form> <!-----------------------------------THE CONTENT GOES ABOVE THIS LINE----------------------------------->                 </td>         <td width="20px">&nbsp;</td>     </tr> </table> <?php include('include/loginfooter2.php'); ?> [/code]
  8. It doesn't start messing up until i get to the product_edit.php page....Thanks. [code] <?php     include('require.php');     include('include/HTML_header.php'); ?> <table id="table_main" class="table_main">     <tr>         <td colspan="4">             <?php include('include/header.php'); ?>         </td>     </tr>     <tr>         <td id="table_left" width="150px" align="left">             <?php category_list_by_price(); ?><br />             <?php category_list(); ?><br />             <?php searchform(); ?>         </td>         <td width="20px"> </td>         <td id="table_content" width="560px" align="left">                   <!-----------------------------------THE CONTENT GOES BELOW THIS LINE-----------------------------------> <?php //if($_SESSION['user_id']=='user_id'){ // This page edits a product. // This page is accessed through view_products.php. // Check for a valid product ID, through GET or POST. if ( (isset($_GET['product_id'])) && (is_numeric($_GET['product_id'])) ) { // Accessed through view_products.php     $product_id = $_GET['product_id']; } elseif ( (isset($_POST['product_id'])) && (is_numeric($_POST['product_id'])) ) { // Form has been submitted.     $product_id = $_POST['product_id']; } else { // No valid ID, kill the script.     echo '<div class="titletext">Page Error 37</div>     <p class="error">This page has been accessed in error.</p><p><br /><br /></p>';     //include ('./includes/footer.html');     echo "</td></tr></table>";     include('include/loginfooter2.php');     exit(); } require_once ('../mysql_connect.php'); // Connect to the db. // Check if the form has been submitted. if (isset($_POST['submitted'])) {     $errors = array(); // Initialize error array.          // Check for a product title.     if (empty($_POST['product_title'])) {         $errors[] = 'You forgot to enter a product title.';     } else {         $product_title = escape_data($_POST['product_title']);     }          // Check for a description.     if (empty($_POST['product_description'])) {         $errors[] = 'You forgot to enter a description.';     } else {         $product_description = escape_data($_POST['product_description']);     }          if (empty($errors)) { // If everything's OK.              //  Test for unique email address.         $query = "SELECT product_title,product_id FROM products WHERE product_id='$product_id'";         $result = mysql_query($query);         if (mysql_num_rows($result) != 0) {             // Make the query.             $query = "UPDATE products SET product_title='$product_title', product_description='$product_description', product_user_id='$user_id', product_category_id='$category_id', product_price_id='$price_id' WHERE product_id=$product_id";             $result = @mysql_query ($query); // Run the query.             if (mysql_affected_rows() == 1) { // If it ran OK.                              // Print a message.                 echo '<div class="titletext">Edit a Product</div>                 <p>The product has been edited.</p><p><br /><br /></p>';                                              } else { // If it did not run OK.                 echo '<div class="titletext">System Error</div>                 <p class="error">You must make a change to the information in order to submit.</p>'; // Public message.                 //echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message.                 //include ('./includes/footer.html');                 echo "</td></tr></table>";     include('include/loginfooter2.php');     exit();             }                          } else { // Already registered.             echo '<div class="titletext">Error!</div>             <p class="error">An error has occured...Please try again later.</p>';         }     } else { // Report the errors.              echo '<div class="titletext">Error!</div>';         foreach ($errors as $msg) { // Print each error.             echo " - $msg<br />\n";         }         echo '</p><p>Please try again.</p><p><br /></p>';              } // End of if (empty($errors)) IF. } // End of submit conditional. // Always show the form. // Retrieve the product's information. $query = "SELECT products.product_title,products.product_description,products.product_user_id,products.product_category_id,products.product_price_id,products.product_price,users.user_id,users.first_name,users.last_name, category.category_id,category.category_name,price.price_id,price.price_name FROM products,users,category,price WHERE products.product_id=$product_id AND products.product_user_id=users.user_id AND products.product_category_id=category.category_id AND products.product_price_id=price.price_id";         $result = @mysql_query ($query); // Run the query. if (mysql_num_rows($result) == 1) { // Valid product ID, show the form.     // Get the product's information.     $row = mysql_fetch_array ($result, MYSQL_NUM);          // Create the form.     echo '<div class="titletext">Edit a Product</div><br /> <form action="product_edit.php" method="post"> <table>     <tr>         <td width="120">Product Title:</td>         <td width="200"><input type="text" name="product_title" size="30" value="' . $row[0] . '" /></td>             </tr>     <tr>         <td>Description:</td>         <td><textarea name="product_description" cols="25" rows="5">' . $row[1] . '</textarea></td>     </tr>     <tr>         <td>User:</td>         <td><select name="user_id">';         $query = "SELECT user_id,first_name,last_name,email FROM users ORDER BY first_name ASC";         $result = mysql_query($query,$connect);         for($i=0;$i<mysql_num_rows($result);$i++){             list($user_id,$first_name,$last_name,$email)=mysql_fetch_row($result);             echo "<option value='$user_id'>$first_name   $last_name</option>";         }         echo '</select></td>     </tr>     <tr>         <td>Category:</td>         <td><select name="category_id">';         $query = "SELECT category_id,category_name FROM category ORDER BY category_name ASC";         $result = mysql_query($query,$connect);         for($i=0;$i<mysql_num_rows($result);$i++){             list($category_id,$category_name)=mysql_fetch_row($result);             echo "<option value='$category_id'>$category_name</option>";         }         echo '</select></td>     </tr>     <tr>         <td>Price:</td>         <td><select name="price_id">';         $query = "SELECT price_id,price_name FROM price ORDER BY price_name ASC";         $result = mysql_query($query,$connect);         for($i=0;$i<mysql_num_rows($result);$i++){             list($price_id,$price_name)=mysql_fetch_row($result);             echo "<option value='$price_id'>$price_name</option>";         }         echo '</select></td>     </tr>     <tr>         <td>Price:</td>         <td><input type="text" name="product_price" size="30" maxlength="30" value="' . $row[5] . '" /></td>     </tr>     <tr>         <td><input type="submit" name="submit" value="Submit" /></td>     </tr> </table> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="product_id" value="' . $product_id . '" /> </form>'; } else { // Not a valid product ID.     echo '<div class="titletext">Page Error 181</div>     <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; } /*}else{     echo "You are not authorized to view this page."; } */ ?> <!-----------------------------------THE CONTENT GOES ABOVE THIS LINE----------------------------------->                 </td>         <td width="20px"> </td>     </tr> </table> <?php include('include/loginfooter2.php'); ?>[/code]
  9. I cant seem to get this upload form working properly...It comes up w/errors....Can anyone help? [code] <?php // This page allows users to upload files to the server. if (isset($_POST['submitted'])) { // Handle the form.     require_once ('../mysql_connect.php'); // Connect to the database.          // Create index names to refer to the proper upload and description.     $filename = 'product' . $i;     //$description = 'description' . $i;          /*// Add the record to the database.     $query = "INSERT INTO products (product_user_id,product_category_id,product_price_id,product_title,product_description,product_date,product_price,product_ipaddress,product_file_name, product_file_size, product_file_type) VALUES ('".$_SESSION['user_id']."','".$_POST['product_category_id']."','".$_POST['product_price_id']."','".$_POST['product_title']."','".$_POST['product_description']."',NOW(),'".$_POST['product_price']."','".$_SERVER['REMOTE_ADDR']."','{$_FILES[$filename]['name']}','{$_FILES[$filename]['size']}','{$_FILES[$filename]['type']}')";             $result = mysql_query ($query);             if ($result) {                 // Return the upload_id from the database.                 //$product_id = mysql_insert_id();                 // Move the file over.                 if (move_uploaded_file($_FILES[$filename]['tmp_name'], "../uploads/$product_id")) {                     echo '<p>File number ' . ($i + 1) . ' has been uploaded!</p>';                 } else { // File could not be moved.                     echo '<p><font color="red">File number ' . ($i + 1) . ' could not be moved.</font></p>';                     // Remove the record from the database.                     $query = "DELETE FROM products WHERE product_id = $product_id";                     $result = mysql_query ($query);                 }                              } else { // If the query did not run OK.                 echo '<p><font color="red">Your submission could not be processed due to a system error. We apologize for any inconvenience.</font></p>';                 // Print the query and invoke the mysql_error() function to debug.             }*/                         // Add the record to the database.             $query = "INSERT INTO products (product_file_name, product_file_size, product_file_type) VALUES ('{$_FILES[$filename]['name']}', {$_FILES[$filename]['size']}, '{$_FILES[$filename]['type']}')";             $result = mysql_query ($query);                      if ($result) {                                  // Return the upload_id from the database.                 $product_id = mysql_insert_id();                                  // Move the file over.                 if (move_uploaded_file($_FILES[$filename]['tmp_name'], "../uploads/$product_id")) {                                      echo '<p>File number ' . ($i + 1) . ' has been uploaded!</p>';                                      } else { // File could not be moved.                                      echo '<p><font color="red">File number ' . ($i + 1) . ' could not be moved.</font></p>';                              // Remove the record from the database.                     $query = "DELETE FROM products WHERE product_id = $product_id";                     $result = mysql_query ($query);                                          // Add more detailed error reporting, if desired.                                      }                              } else { // If the query did not run OK.                 echo '<p><font color="red">Your submission could not be processed due to a system error. We apologize for any inconvenience.</font></p>';                 // Print the query and invoke the mysql_error() function to debug.             }                                                                                      } // End of if (isset($the_file)...              //} // End of FOR loop.      //    mysql_close(); // Close the database connection.          ?> <form enctype="multipart/form-data" action="product_add3.php" method="post"> <div class="titletext">Add a Product</div><br /> <input type="hidden" name="MAX_FILE_SIZE" value="524288">     <table>         <tr>             <td width="120"><font color="#FF0033">*</font>Product Title/Name:</td>             <td width="200"><input type="text" name="product_title" size="30" maxlength="50" value="<?php if (isset($_POST['product_title'])) echo $_POST['product_title']; ?>" /></td>         </tr>         <tr>             <td width="120"><font color="#FF0033">*</font>Description:</td>             <td width="200"><textarea name="product_description" cols="23" rows="5"><?php if (isset($_POST['product_description'])) echo $_POST['product_description']; ?></textarea></td>         </tr>         <tr>             <td width="120"><font color="#FF0033">*</font>Category:</td>             <td><select name="product_category_id">             <?php                 $query="select category_id,category_name from category where category_sub_id=0 and category_active='a'    order by category_name";                 $result=mysql_query($query,$connect);                     for($i=0;$i<mysql_num_rows($result);$i++){                         list($category_id,$category_name)=mysql_fetch_row($result);                         echo "<option value='$category_id'>$category_name</option>";                     }                         ?></select></td>         </tr>         <tr>             <td width="120"><font color="#FF0033">*</font>Price Category:</td>             <td><select name="product_price_id">             <?php                 $query="select price_id,price_name from price where price_active='a' order by price_id";                 $result=mysql_query($query,$connect);                     for($i=0;$i<mysql_num_rows($result);$i++){                         list($price_id,$price_name)=mysql_fetch_row($result);                         echo "<option value='$price_id'>$price_name</option>";                     }                         ?></select></td>         </tr>         <tr>             <td width="120">Price:</td>             <td width="200"><input type="text" name="product_price" size="10" maxlength="10" value="<?php if (isset($_POST['product_price'])) echo $_POST['product_price']; ?>" /></td>         </tr>                         <tr>             <td>Image:</td>             <td><input type="file" name="product' . $i . '" /></td>         </tr>         <tr>             <td><input type="submit" name="submit" value="Submit" /></td>             <td>(<font color="#FF0033">*</font> = required field)</td>         </tr>     </table>     <input type="hidden" name="submitted" value="TRUE" /> </form>[/code]
  10. I just built a site with a login system...got it out of a book and edited it slightly to make it work...The problem that I just found, is that when you log in, you can change postings...Something is happening so that when you click to change a posting, then click on the Account button to see your account info, it switches to another person's info...depending on what page you click on before going to your Account page, the account info will be different...Any ideas on how to fix this? Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.