Page 1 of 1

ddl with database

Posted: Tue Jan 11, 2011 11:26 pm
by madu
hi friends,,
i want to create table in database,,, the table name is which is selected in dropdown list,,,, i loaded the dropdown items,,, i got the selected value into variable also ,,,i put some lines into multiple comment line ,,, if i remove comment the page doesn't show nothing ,,,, now how can i create the table ,,, the table name should be taken from drop down ,,,,i have included connection string in tacre.php,,,,,

Code: Select all

<html>
<body>
<form name=for method=post onClick="showSelected();" action="<?php echo $_SERVER[PHP_SELF]; ?> " >
Enter the user name:&nbsp<input type=text name=uname style="position:absolute;left:160px"><br><br>
Enter the mail id:&nbsp<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=0;
$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;
echo $rt;
/**isset($_POST[submit]) && $_POST[submit] == "submit")
 {
$un=$_POST['uname'];
$e=$_POST['eid'];
mysql_query("insert into $rt values('".$un."','".$e."')" or die("error in insertion");
} **/
?>
</body>
</html>