Jump to content

Problem in Sequence


ballouta

Recommended Posts

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>";
	}

?>

Link to comment
https://forums.phpfreaks.com/topic/156635-problem-in-sequence/
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/156635-problem-in-sequence/#findComment-824779
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.