AdRock Posted November 12, 2006 Share Posted November 12, 2006 I have a form and I want to choose the category based on a drop down selection so it inserts the the category into a database.I need to know how I can chnage my form so instead of having to type something in a text box, I can use the selection box. At the moment it will work with the text box but not the selection.How do i get it to work with my selection?this is the code that works<?php //This is the directory where images will be saved $target = "pics/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $pic=($_FILES['photo']['name']); if (!isset($_POST['desc'])) {?><form enctype="multipart/form-data" action="<? $_SERVER['PHP_SELF']; ?>" method="POST"> Description: <input type="test" name="desc"><br>Photo: <input type="file" name="photo"><br> <input type="submit" value="Add"> </form><?}else {// Connects to your Database // I've taken out the database stuff hereif(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."; } //image manipulation stuff here}?>I have got a form that works but not with [b]action="<? $_SERVER['PHP_SELF']; ?>"[/b][code]<form enctype="multipart/form-data" action="index.php?page=image" method="POST"> <p style="margin-left:10px;">Gallery to upload to:<br> <select name="gallery" size="1"> <option value="jack">Jack</option> <option value="honeylands">Honeylands</option> <option value="events">Events</option> <option value="art">Art Auction</option> </select> <p style="margin-left:10px;">Image to upload:<br> <input type="file" name="photo"><br> <P><input type="submit" name="submit" value="Upload Image" class="submit-button" style="margin-left:10px;"></p> </form>[/code]Anyone know how I can use the second style form but use it on one php page instead of calling another script? Link to comment https://forums.phpfreaks.com/topic/27006-how-to-use-a-form-selection-with-php-to-upload-images-resolved/ Share on other sites More sharing options...
chiprivers Posted November 12, 2006 Share Posted November 12, 2006 Do you mean you want to change the Description input text box to the select group? Link to comment https://forums.phpfreaks.com/topic/27006-how-to-use-a-form-selection-with-php-to-upload-images-resolved/#findComment-123489 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.