I'm a fairly new programmer and I'm currently working on creating a program for a web-based art exhibit that would will display a random image and text using data from a PHP form which requires inputs for both.
I will need to create a PHP form that gathers text and a picture from the visitor. Example PHP page:
*What is your name?* = Max
*Upload photo.* = pic.jpg
The finished project would be a webpage that - on refresh - would display the image and the text gathered from the PHP form randomly. So on refresh the page would display a random text input (I.E Max, Alan, Mark, etc.) and a random picture (I.E pic.jpg, pic1.jpg, pic2.jpg) I'm guessing from a MySQL database.
The page, on refresh, would therefore display something like this:
Max / pic.jpg
REFRESH
Alan / pic3.jpg
REFRESH
Mark / pic2.jpg
And so on...
This is what I have so far:
    <?php 
 //This is the directory where images will be saved 
 $target = "images/"; 
 $target = $target . basename( $_FILES['photo']['name']); 
 //This gets all the other information from the form 
 $name=$_POST['name'];  
 $pic=($_FILES['photo']['name']); 
 // Connects to your Database 
 mysql_connect("mysite.com", "username", "password") or die(mysql_error()) ; 
 mysql_select_db("db_name") or die(mysql_error()) ; 
 //Writes the information to the database 
 mysql_query("INSERT INTO `employees` VALUES ('$name', '$pic')") ; 
 //Writes the photo to the server 
 if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) 
 { 
 //Tells you if its all ok 
 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; 
 } 
 else { 
 //Gives and error if its not 
 echo "Sorry, there was a problem uploading your file."; 
 } 
 ?>
Any help on this would be much appreciated!
Thank you!
 
     
     
    