Jump to content

Images Uploading/Displaying


dfowler

Recommended Posts

Hey everybody.  This is a two part question.  I have never actually had to deal with this before, and I have read through several topics about this here.  It seems consensus for the best option when dealing with images is to save them on the server, then have the file location in the database.  Here is what I am trying to do.

 

Upload

A user can create a record that includes a name and a description about themselves then has the option to upload an image.  Then when they submit the image is uploaded and kept in a directory while the image location is uploaded (along with the name and description) to a database. (I have the form created right now minus the image part):

<form action="addM2.php" method="POST">
<table>
<tr>
	<td>Name: <input type="text" name="name" /></td>
</tr>
<tr>
	<td>Description</td>
</tr>

<tr>
	<td><textarea name="description"></textarea></td>
</tr>
<tr>
	<td><input type="submit" value="Submit" /><input type="reset" value="Clear" /></td>
</tr>
</table></form>

<?php
include '../system.php';

$name = $_POST['name'];
$description = $_POST['description'];

$SQL = "INSERT INTO table set name='$name', description='$description'";

mysql_query($SQL);

print "Meal successfully added!";
?>

 

Display

To display everything I want a page where the name (in a checkbox) and a thumbnail of the image are pulled dynamically and displayed.  This will give a user the option to pick who they want to hear more about.  However, if there are no images it still displays all the names (in checkboxes).  Once again, minus the image part I think I can do this.  Any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/85969-images-uploadingdisplaying/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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