Jump to content

uploading selected choice from dropdown menu to database


blui

Recommended Posts

Hi all, I am very new to all this so can someone please point me in the right direction.

I am developing a site where users can upload images which are automatically resized and stored in a specfic directory. The user then needs to be able to select which image they wish to have shown on there website today. I have managed to get a dynamically created dropdown list showing all of teh files with the directory. But I do not know how to get that selected choice saved on to the database so that a specific webpage, can call the image the user selected.

 

I have included my script showing teh dropdown menu below, any help will be greatly appreciated. Thanks blu

 

<!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">

<?

require_once('connectionlocal.php');

?>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>

</head>

<body>

<form id="form1" name="form1" method="post" action="..postinfo2.php">

  <label>Choose your image

  <select name="imagelist"> 

<?

 

$file_dir="images";

 

$dir=opendir($file_dir);

    while ($file=readdir($dir))

    {

        if ($file != "." && $file != "..")

        {

            echo "<option value=".$file_dir."/".$file." >".$file."";

            echo "<br></option>";

        }

    }

 

?>

</select>

  </label>

  <input name="submit" type="button" value="submit" />

</form>

</body>

</html>

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.