<?php
global $Host;
global $Username;[attachment=31162:svRutmTable.php]
global $password;
global $database;
function getConnection()
{
$Host = "localhost";
$Username = "root";
$password = "";
$database = "labdata";
$oMysqli = new mysqli($Host,$Username,$password,$database);
// return($oMysqli);
}
?>
<?php
// include_once "dreportCreation.php";
function displaydata($column,$rows)
{
echo "<table border='1' align='center'>";
for($i = 0;$i<$_POST['column'];$i++)
{
echo "<tr>".$i."</tr>";
for($j = 0; $j <$_POST['rows'];$j++)
{
echo "<td>" ."<input type=\"text\" name='column_$i[$j]'>"."</td>";
}
}
echo "</table>";
echo "<input type=\"submit\" name=\"ok\" value=\"ok\" onclick=\"add()\">";
//function displaydata($column = NULL) {if($id == NULL) Event::run('system.52');}
}
?>
<html>
<head>
<title>aa</title>
</head>
<body>
<form name="reportCreation" method="post">
<label for='Table'>Define Table</label>
<label for='column'>Row</label>
<input type="text" name="column"></input>
<label for='rows'>Column</label>
<input type="text" name="rows"></input>
<input type="submit" name="submit" value="submit" onclick="displaydata();">
<!--$plength = count($_POST['instrument_codes']);
for($j=0;$j<$plength;$j++)
{
$b = $_POST['instrument_codes'][$j];
$pa = array('instrument_codes' => $b['instrument_codes']);
foreach($pa as $l => $m)
{
$pa[$l] = mysql_real_escape_string($m);
}
$Instrumentcodes = $pa['instrument_codes'];
$Instrumentcodes = $_POST['instrument_codes'][$j];
}
--->
</form>
<?php
if(isset($_POST['submit']))displaydata();// Show data INSIDE form
if(isset($_POST['ok']))displaydata();
{
function add()
{
$length = count($_POST['rows']);
for($k=0;$k<$length;$k++)
{
$a = $_POST['rows'][$k];
$na =array('rows' => $a['rows']);
foreach($na as $l => $m)
{
$na[$k] = mysql_real_escape_string($m);
}
$rows = $na['rows'][$k];
$rows = $_POST['rows'][$k];
// print_r($rows);exit();
$InsertQuery = "INSERT INTO rct(testname,result,unit,NormalRange) VALUES('$testname','$result','$unit','$NormalRange')";
$oMysqli = getConnection();
$oMysqli->query($InsertQuery);
}
}
}
?>
</body>
</html>
Attached File(s)
-
svRutmTable.php (2.63K)
Number of downloads: 10 -
svRutmTable.php (2.63K)
Number of downloads: 9

New Topic/Question
This topic is locked



MultiQuote


|