Help
Posted: Fri Feb 29, 2008 3:59 pm
I have this code
And what I have in the text file are lines of urls to photos, ie http://www.website.com/pic.jpg, and what I am trying to figure out is how to get the photo I have selected in the drop list to display. any help would be great.
Code: Select all
<?
//var to hold list location (substitute your own file name and text file)
$your_file = "photolink.txt";
//open the file
$read_your_file = @fopen($your_file, "r") or die ("Couldn't Access $your_file");
//create a variable to hold the contents of the file
$contents_your_file = fread($read_your_file, filesize($your_file));
//array of file contents
$your_array = explode("\n",$contents_your_file);
//close the file
fclose($read_your_file);
//counts the number elements in the property_categories array
$num_elmnts_array = count($your_array) ;
//elements in the drop down list
//$drop_elmnts = 0;
//begin creating your dropdown menu...
$your_menu = "<select name=\"you_make_a_name\">";
//For loop to begin
for($counter = 0; $counter < $num_elmnts_array; $counter++){
$your_menu .= "<option value=\"$your_variable\">$your_array[$counter]
</option>";
$counter++;
}
//end select menu
$your_menu .= "</select>";
?>
<html>
<head>
<title>Edit Photos</title>
</head>
<body>
<p><b>Photos</b><br>
<? echo "$your_menu"; ?>
</body>
</html>And what I have in the text file are lines of urls to photos, ie http://www.website.com/pic.jpg, and what I am trying to figure out is how to get the photo I have selected in the drop list to display. any help would be great.