I designed a webpage.In this webpage i read the data and put them into a dropdownlist as you can see here:
<table width="200" border="1">
<?php
include("../inc/mysql.php");
$q2="SELECT * FROM tbl_group;";
$r2=mysql_query($q2);
$n2=mysql_num_rows($r2);
for($i=0;$i<$n2;$i++){
$m2=mysql_fetch_array($r2);
?>
<tr>
<td><a href="insertpage.php?id=<?php echo $m2['id']?>">نمایش</a></td>
</tr>
php }?>
</table>
I link every rows that i read ,and in another query .So after click on each rows my id is sent to the url ,because i need the id value to select a subgroup in another query .In below you can see that i am using id value to select a query :
<table width="200" border="1">
<?php
include("../inc/mysql.php");
if(isset($_GET['id'])){
$q23="SELECT * FROM tbl_cat where idgroup=".$_GET['id'].";";
$r23=mysql_query($q23);
$n23=mysql_num_rows($r23);
for($i=0;$i<$n23;$i++){
$m23=mysql_fetch_array($r23);
?>
<tr>
<td><a href="insertpage.php?catid=<?php echo $m23['id'];?>">انتخاب</a></td>
<td><?php echo $m23['cat']?></td>
</tr>
<?php }}?>
</table>
So in this query i send the catid to url to insert in my table but my code can't detect the catid variable in my url ;
I need this value to insert in my table.
all of these code is placed in a phpfile
<?php
if(isset($_GET["catid"])){
$cat=$_GET['catid'];
include("../inc/mysql.php");
$q="INSERT INTO tbl_text (idcat) VALUES ('$cat');";
$r=mysql_query($q);
}
?>
So my problem is in the second query my code can't read the catid that i sent before via first query ?
thank you