inserting the id of data in the second dropdown menu(this second drop down menu depends on the first drop down menu) in to my database 2.please can anyone teach me how to mantain the userid of some one who logs in so that i can use it later
-
for the first question: pliz help me, i keep getting the error [i]Notice: Undefined index: cat in c:\program files\easyphp1-8\www\myhelpdesk\postqueryagain.php on line 40[/i] if i remove the line $cat=$_GET['cat']; the second drop down menu doesnt function well thanx guys [code] include('connect_db.php'); $quer2=mysql_query("SELECT DISTINCT typename,probtypeid FROM probtype order by typename"); $cat=$_GET['cat'];//This line is added to take care if your global variable is off if(isset($cat) and strlen($cat) > 0) { $quer=mysql_query("SELECT DISTINCT catname FROM category where probtypeid=$cat order by catname"); } else { $quer=mysql_query("SELECT DISTINCT catname FROM category order by catname"); } echo "
"; //Add your form processing page address to action in above line. Example action=dd-check.php // Starting of first drop downlist echo "select problem type"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['probtypeid']==@$cat) { echo "$noticia2[typename]".""; } else { echo "$noticia2[typename]"; } } echo ""; //Starting of second drop downlist echo "Select problem category"; while($noticia = mysql_fetch_array($quer)) { echo "$noticia[catname]"; } echo ""; //This will end the second drop down list echo "
"; ?> [/code] i want to insert the id of the catname.thanx guys nahelna
-
for the first question: pliz help me, i keep getting the error [i]Notice: Undefined index: cat in c:\program files\easyphp1-8\www\myhelpdesk\postqueryagain.php on line 40[/i] if i remove the line $cat=$_GET['cat']; the second drop down menu doesnt function well thanx guys [code] include('connect_db.php'); $quer2=mysql_query("SELECT DISTINCT typename,probtypeid FROM probtype order by typename"); $cat=$_GET['cat'];//This line is added to take care if your global variable is off if(isset($cat) and strlen($cat) > 0) { $quer=mysql_query("SELECT DISTINCT catname FROM category where probtypeid=$cat order by catname"); } else { $quer=mysql_query("SELECT DISTINCT catname FROM category order by catname"); } echo "
"; //Add your form processing page address to action in above line. Example action=dd-check.php // Starting of first drop downlist echo "select problem type"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['probtypeid']==@$cat) { echo "$noticia2[typename]".""; } else { echo "$noticia2[typename]"; } } echo ""; //Starting of second drop downlist echo "Select problem category"; while($noticia = mysql_fetch_array($quer)) { echo "$noticia[catname]"; } echo ""; //This will end the second drop down list echo "
"; ?> [/code] i want to insert the id of the catname.thanx guys nahelna
If you're wondering why your question got marked down it's probably because of essay-sized title and ugly code-dump. Without paying any attention to your code or what you are trying to do, the error message tells you everything you need to know. On line 40 of the code (whichever that is, I'm not figuring it out from here) something is trying to access the 'cat' element of an array. This element doesn't exist, hence the error.
-
If you're wondering why your question got marked down it's probably because of essay-sized title and ugly code-dump. Without paying any attention to your code or what you are trying to do, the error message tells you everything you need to know. On line 40 of the code (whichever that is, I'm not figuring it out from here) something is trying to access the 'cat' element of an array. This element doesn't exist, hence the error.
sorry guess am just confused,forgot to use the tags, i tried to remove it but when i do that the second dropdown menu stops depending on the first dropdown menu. ok, is there anyway i can generate two dropdown menus one depending on the other the error is Notice: Undefined index: cat in c:\program files\easyphp1-8\www\myhelpdesk\dropdown2.php on line 13 this line reads
$cat = $_GET['cat'];//
<?php
//include('connect_db.php');
$quer2 = mysql_query("SELECT DISTINCT typename,probtypeid FROM probtype order by typename");
$cat = $_GET['cat'];//This line is added to take care if your global variable is offif(!empty($cat))
{
$quer=mysql_query('SELECT DISTINCT `catname` FROM `category` WHERE`probtypeid`= \''.mysql_escape_string($cat).'\' ORDER BY `catname`');
}
else
{
$quer=mysql_query('SELECT DISTINCT `catname` FROM `category` OREER BY `catname`');
}echo '<form method="post" name="f1" action="postquery.php">';
//Add your form processing page address to action in above line. Example action=dd-check.php
// Starting of first drop downlist
echo '<select name="cat" onchange="reload(this.form)">
<option value="">select problem type</option>';while($noticia2 = mysql_fetch_assoc($quer2))
{
if($noticia2['probtypeid']==@$cat)
{
echo ' <option selected value="',mysql_escape_string($noticia2['probtypeid']),'">',$noticia2['typename'],'</option>',"\n";
}
else
{
echo ' <option value="',$noticia2['probtypeid'],'">',$noticia2['typename'],'</option>',"\n";
}
}
echo '</select>';//Starting of second drop downlist
echo '<select name="subcat"><option value="">Select problem category</option>',"\n";while($noticia = mysql_fetch_array($quer))
{
echo ' <option value="',$noticia['catname'],'">',$noticia['catname'],'</option>',"\n";
}echo '</select>';
//This will end the second drop down list
echo '</form>';
?> -
If you're wondering why your question got marked down it's probably because of essay-sized title and ugly code-dump. Without paying any attention to your code or what you are trying to do, the error message tells you everything you need to know. On line 40 of the code (whichever that is, I'm not figuring it out from here) something is trying to access the 'cat' element of an array. This element doesn't exist, hence the error.