Hi all,
I’m trying to code a dependable dropdownlist with php/mysql/ajax.
Goal is to select one thing in the first dropdown and depending on that option (and without reloading the page) enabling the second and add the options to the second, dependant on the first.
This is the index :
[code]<?php
require_once($_SERVER[‘DOCUMENT_ROOT’].’/dbconnect.php’);
?>
<?php $id_test=$_POST['selector']; $N = count($id_test); for($i=0; $i < $N; $i++) { $result = mysqli_query($conn, "SELECT * FROM cloud where id='$id_test[$i]'"); while($row = mysqli_fetch_array($result)) { $id_bird = $row['id']; ?>City : --Select City--
And this is the edit_form.php part :
[code]<?php
require_once($_SERVER[‘DOCUMENT_ROOT’].’/dbconnect.php’);
$cat_id = $_GET[‘cat_id’];
$cloud_id = $_GET[‘id’];
if($_POST[‘id_test’])
{
$id_test=$_POST[‘id_test’];
$data=$_POST[‘data’];
$sql=mysqli_query($conn, “SELECT * FROM link_category_cloud WHERE category_id={$cat_id}”);
$data=$row[‘cloud_id’];
$id_test=$_POST[‘id_test’];
echo ‘’.$id_test.’ ‘.$data.’’;
//}
}
?>[/code]
Now, it does not work. I’m not only tring to pass through ID to ‘edit_form.php’, but also $data and $id_test[i]. Any idea how I can do this?
Thank you very much, all help is so appreciated!!