ballouta Posted May 3, 2009 Share Posted May 3, 2009 Hello I have this php code, if I choose in the previous form a gallery from the drop down menu only, the first insertion here works properly, if I make a selection for gallery and video in the same time in the previous form, the insertion of the gallery only works, if I make a selection for video only in the previous form, the video (second insertion) works correctly. The problem is the insertion for the gallery and video in the same time don't work, Thank you <?php $eventid = $_POST['event']; $gallery = $_POST['gallery']; $vids = $_POST['vids']; $speech = $_POST['speech']; $down = $_POST['down']; if ($gallery != "") { $query="INSERT INTO `links` (`id` ,`event`, `links`, `type`) VALUES ( NULL , '$eventid', '$gallery', 'gallery')"; $query_result = mysql_query ($query) or die("Problem with the query: <br>" . mysql_error()); echo "The gallery <b>$gallery</b> has been linked to the event.<br>"; } elseif ($vids != "") { $query="INSERT INTO `links` (`id` ,`event`, `links`, `type`) VALUES ( NULL , '$eventid', '$vids', 'video')"; $query_result = mysql_query ($query) or die("Problem with the query: <br>" . mysql_error()); echo "The video <b>$vids</b> has been linked to the event.<br>"; } elseif ($speech != "") { $query="INSERT INTO `links` (`id` ,`event`, `links`, `type`) VALUES ( NULL , '$eventid', '$speech', 'speech')"; $query_result = mysql_query ($query) or die("Problem with the query: <br>" . mysql_error()); echo "The speech <b>$speech</b> has been linked to the event.<br>"; } elseif ($down != "") { $query="INSERT INTO `links` (`id` ,`event`, `links`, `type`) VALUES ( NULL , '$eventid', '$down', 'download')"; $query_result = mysql_query ($query) or die("Problem with the query: <br>" . mysql_error()); echo "The download <b>$down</b> has been linked to the event.<br>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/156635-problem-in-sequence/ Share on other sites More sharing options...
ignace Posted May 3, 2009 Share Posted May 3, 2009 Add: <?php if ($gallery != '' && $vids != '') .. ?> However your query doesn't allow to select both gallery and vids you need a many-to-many table to store this kind of relation. Quote Link to comment https://forums.phpfreaks.com/topic/156635-problem-in-sequence/#findComment-824777 Share on other sites More sharing options...
ballouta Posted May 3, 2009 Author Share Posted May 3, 2009 let me add smthg please I have other two drop down menus in the previous form, so i can not predict what selection the user might choose. in my posted question, i was choosing a gallery name and a video name in the same time, but later i might choose a gallery with a (speech) as posted in my php code. So, i have four drop down menus, the first option of each is like: <option value=""> selecy <media> </option> and in my php i want to see what media did the user choose, thanks and sorry for not mentioning this in the begining, i thought the first two drops will help me fix my code Quote Link to comment https://forums.phpfreaks.com/topic/156635-problem-in-sequence/#findComment-824779 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.