Hi i'm trying to fill a variable (location) with a selected image, the images are coming from a folder on the server and I want the user to be able to pick an image, fill in the rest of the textboxes and when submit is pressed send these variables to another form.
The other forms work fine, I just don't know how to get the value of the radio button to the text variable location. I previously had the user fill a textbox with the whole path
Thanks in advance and Happy Holidays
<form action="appendlist.php" method="post">
<input name="title" type="textbox" placeholder="Title" class="form-control" ><br><br>
<input name="alt" type="textbox" placeholder="Alt text" class="form-control" ><br><br>
<input name="caption" type="textbox" placeholder="Image caption" class="form-control" ><br><br>
<?php
$dir = 'images/comics/';
if (!isset($_POST['submit']))
{
if ($dp = opendir($dir))
{
$files = array();
while (($file = readdir($dp)) !== false)
{
if (!is_dir($dir . $file))
{
$files[] = $file;
}
}
closedir($dp);
}
else
{
exit('Directory not opened.');
}
if ($files)
{
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
foreach ($files as $file)
{
echo '<input type="radio" name="files[]" value="' . $file . '" /> ' .
$file . '<br />';
}
echo '</form>';
}
else
{
exit('No files found.');
}
}
else
{
if (isset($_POST['files']))
{
foreach ($_POST['files'] as $value)
{
echo $dir . $value . '<br />';
}
}
else
{
exit('No files selected');
}
}
?>
<br>
<input name="password" type="textbox" placeholder="Enter password" class="form-control" >
<br>
<!--<input name="location" type="textbox" placeholder="File location" class="form-control`"-->
<input type="submit" value="Add to reel" name="submitappend">
</form>