I am trying to find out how i would include the option to upload a picture as part of a form.

i need help with the following:

1. how to add picture upload to form

2. how to store image in folder with the location stored in the database.

3. how to retrieve image

4. how to insert current date into database in 17/01/10 (UK format)

<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
        <table align="center">
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>Title:</td>
            <td align="left" valign="top"><input type="text" name="title" value="" size="32"> 
              <span class="admin_list">MAX 35 Characters </span></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right" valign="top">Full Story:</td>
            <td align="left" valign="top"><textarea name="story" cols="80" rows="5"></textarea>
            </td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right" valign="top">Summary:</td>
            <td align="left" valign="top"><textarea name="summary" cols="80" rows="2"></textarea>
            </td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>Link:</td>
            <td align="left" valign="top"><input type="text" name="link" size="32"> 
              <span class="admin_list">use www. format </span></td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>Image:</td>
            <td align="left" valign="top"><input type="text" name="image" size="32"></td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>Date:</td>
            <td align="left" valign="top"><input type="text" name="date" value="" size="32"> 
              <span class="admin_list">Date Format 00/00/00</span> </td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>&nbsp;</td>
            <td align="left" valign="top"><input type="submit" value="Add News Story"></td>
          </tr>
        </table>
        <input type="hidden" name="story_no" value="">
        <input type="hidden" name="MM_insert" value="form1">
      </form>

Recommended Answers

All 2 Replies

Wow. One problem at a time there.

First learn how to upload files with some basic html forms, look here:
http://www.tizag.com/phpT/fileupload.php

Then follow up on this tutorial that's actually for image uploads
http://www.w3schools.com/PHP/php_file_upload.asp

One thing you'll notice in both tutorials is the use of:

enctype="multipart/form-data"

..in the form tag, which your above code does not include. When uploading data files, that code snippet is necessary for correct operation.

If you are not familiar with PHP it would help to read about it
http://www.w3schools.com/PHP/default.asp

If you've never written code of this sort before, I suggest that you start with a small html form, and not what you have going on above.

Good luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.