Jump to content

help - inputting image into a database


ikon

Recommended Posts

I am trying to add an image for a new category in my category however, its inputting all the information apart from the image location

 

i have 2 pages, 1 the form to capture the data

 

<?php

session_start();

if(isset($_SESSION['username'])==false){

header("Location: ../index/ImprintablesHome.php");

exit();

}

 

require "connect.php";

 

?>

 

<!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>Add a New Catagory</title>

</head>

 

<body>

<form action="addnewcatagoryscript.php" method="get">

<table width="606" border="0">

  <tr>

    <td>Caragory ID</td>

    <td><input name="cat_id" type="text" id="cat_id" value="<?php $cat_id?>" /></td>

    <td> </td>

  </tr>

  <tr>

    <td width="291"><label>Parent ID</label></td>

    <td width="166"><label>

      <input name="cat_parent_id" type="text" id="cat_parent_id" value="<?php $cat_parent_id?>" />

    </label></td>

    <td width="135"> </td>

  </tr>

  <tr>

    <td>Catagory Name (Max 50 Characters)<br />

      Eg Mouse Mat<br />

    <br /></td>

    <td><label>

      <input name="cat_name" type="text" id="cat_name" value="<?php $cat_name?>" />

    </label></td>

    <td> </td>

  </tr>

  <tr>

    <td><p>Catagory Description</p>    </td>

    <td><label>

      <input name="cat_description" type="text" id="cat_description" value="<?php $cat_description?>" />

    </label></td>

    <td> </td>

  </tr>

  <tr>

    <td>Catagory Image</td>

    <td><input name="cat_image" type="file" id="cat_image" value="<?php $cat_image?>" /></td>

    <td> </td>

  </tr>

  <tr>

    <td> </td>

    <td><label>

      <input type="submit" name="CatSubmit" id="CatSubmit" value="Submit New Catagory" />

    </label></td>

    <td> </td>

  </tr>

  <tr>

    <td> </td>

    <td><label>

      <input type="reset" name="ClearForm" id="ClearForm" value="Clear Form" />

    </label></td>

   

    <td> </td>

  </tr>

  <tr>

    <td> </td>

    <td> </td>

    <td> </td>

  </tr>

  <tr>

    <td> </td>

    <td> </td>

    <td> </td>

  </tr>

  <tr>

    <td> </td>

    <td> </td>

    <td> </td>

  </tr>

  <tr>

    <td> </td>

    <td> </td>

    <td> </td>

  </tr>

</table>

</form>

</body>

</html>

 

 

Link to comment
Share on other sites

Is it the case that the image location is not being put into the database? Or that the image is not displaying when the information is pulled back from the database later? Are you using move_uploaded_file() to put the file in the right directory, and if so is this functioning properly. What is your SQL statement, and your database layout?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.