hello every one i have created a code to create html table from php. simply user enter column and row no. and submit.
this data will create a table for the same.

now i want to put some names with this table. like each table column have a name from other sql table. i have tried a lot but both
these things not working together. when only sql query works and table will not be created if i stop sql query then table will be created.

please help me to do this.

code is:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Marks Sheet</title>
<script type="text/javascript">
function mess()
window.alert("First row must be used for Column Heading");



<body onLoad="mess()">


/*echo $exam; echo "<br>";
echo $sub; echo "<br>";
echo $col; echo "<br>";*/

echo "<p align='center'<b><font size='+2'>". $exam . "</font></b></p>";
echo "<p align='center'<b><font size='+1'>". $sub . "</font></b></p>";

$con = mysql_connect("localhost","root","");
if (!$con)
  die('Could not connect: ' . mysql_error());

mysql_select_db("marks", $con);

$result = mysql_query("SELECT * FROM vi");

 while($row = mysql_fetch_array($result))
  echo $row['1'];
  echo "<br />";


echo"<div align='center'";
echo "<form name='sheet' action='csheet.php' onsubmit='return check()' method='post'>";

echo"<table width='200' border='1'>";


echo"<tr bgcolor='#0099FF'>";

    echo"<td><input type='text' name='' size='8' /></td>";




echo "<input type='submit' value='Submit'>";
echo "</form></div>";


where you have name='', change it to name='" . $rowname . '"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.