Ok here is my problem and where I am at this far, first thing I needed to do
is to read the contents of a directory and place the results into a select
box in a form (accomplished), now where I am stuck is passing the selection
from said select box to another script so it may be put into a mysql
database table... my code is as follows:
<?php
$dir_name = "/path/to/images/directory/";
$dir = opendir($dir_name);
$file_list .= "<p><FORM METHOD=\"post\" ACTION=\"index_done.php3\">
<SELECT NAME=\"files\">$file_name";
 while ($file_name = readdir($dir)) {
  if (($file_name != ".") && ($file_name !="..")) {
  $file_list .= "<OPTION VALUE=\"$file_name\"
NAME=\"$file_name\">$file_name</OPTION>";
  }
 }
 $file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\"
VALUE=\"select\"></FORM></p>";
 closedir($dir);
?>
within the page... I echo the results like so:
<? echo "$file_list"; ?>
so far so good, now on the index_done.php3 my code is put into a require
statement and the required file code is as follows...
<?php
$db_name = "database_name";
$table_name = "cm_index";
$connection = @mysql_connect("localhost", "username", "password") or die
("Could not connect to database.  Please try again later.");
$db = @mysql_select_db("$db_name",$connection) or die ("Could not select
database table. Please try again later.");
$sql = "UPDATE $table_name SET file_name=\$file_name\"";
$result = @mysql_query($sql, $connection) or die ("Could not execute query.
Please try again later.");
?>
I think I need a new pair of eyes to review this and let me know where I am
going wrong, also on another note I don't want to put the file in the
database table I want to put the path to the file in the database table, any
help would be greatly appriciated. =)
Jas



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to