now i have got partial code for my program,,,,still i cant insert value to database table,,,the table name should be taken from dropdown list ,,,,but no error comes,,,,help me
Code: Select all
<html>
<body>
<form name=for method=post onClick="showSelected();" action="<?php echo $_SERVER[PHP_SELF]; ?> " >
Enter the user name: <input type=text name=uname style="position:absolute;left:160px"><br><br>
Enter the mail id: <input type=text name=eid style="position:absolute;left:160px">
<input type=submit name=but style="position:absolute;left:140px;top:150px" value=Add Me><br>
</form>
<?php
session_start() or die("errror");
include "tacre.php";
//$rt=trim("None");
$da= "show tables";
$ds=mysql_query($da) or die("Error While retreiving tables". mysql_error());
$t=0;
$dar=array();
while($er=mysql_fetch_assoc($ds))
{
//print $er['Tables_in_gm']."<br>";
$dar[$t]=$er['Tables_in_gm'];
$t++;
}
echo "<br>";
echo "Select the group you want to add =>";
echo "<select id=ty name=group>";
echo "<OPTION > None</option>";
foreach ($dar as $key => $value)
{
echo "<OPTION > $value</option>";
}
echo "</select>";
$rt='<script language=javascript>
function showSelected()
{
var show=document.getElementById("ty").options[document.getElementById("ty").selectedIndex].value;
document.write(show);
}
</script>';
//$_SESSION['tab']= $rt;
if(isset($_POST[but]))
{
$un=$_POST['uname'];
$e=$_POST['eid'];
//print_r($rt);
if(mysql_query("insert into $rt values('".$un."','".$e."')" or die("error in insertion")))
echo "Successfully Added";
}
?>
</body>
</html>