Lab Test 3- Web Technology Weekday Paper Answer
HTML
<form action="test1.php" method="POST">
<table>
<tr>
<th>Table 01 Details</th>
</tr>
<tr>
<td><label for="PO_No">PO_No:</label></td>
<td><input type="text" name="poNo" id="PO_No"></td>
</tr>
<tr>
<td><label for="PO_Date">PO_Date:</label></td>
<td><input type="date" name="poDate" id="PO_Date"></td>
</tr>
<tr>
<td><label for="Emp_Code">Emp_Code:</label></td>
<td><input type="text" name="empCode" id="Emp_Code"></td>
</tr>
<tr>
<td><label for="Supp_No">Supp_No:</label></td>
<td><input type="text" name="suppNo" id="Supp_No"></td>
</tr>
</table>
<br>
<input type="submit" name="update">
</form>
PHP
<?php
$con = mysqli_connect('localhost','root','root','demo',8000);
if(!$con) {
die("Could not connect");
} else {
echo "Congrats";
echo "<br/>";
$sql = "INSERT INTO Table1(PO_No, PO_Date, Emp_Code, Supp_No)
VALUES(
'$_POST[poNo]',
'$_POST[poDate]',
'$_POST[empCode]',
'$_POST[suppNo]'
)";
}
if(!mysqli_query($con, $sql)) {
die("Error");
} else {
echo "1 record added to Table 01";
}
mysqli_close($con);
?>
"demo" is my database name
Tables and Relationship
You should submit HTML, PHP files and Export database as SQL format and submit all three files.If you could not export database check the video. click
Thank You
great
ReplyDeleteNice
ReplyDeleteSuperb
ReplyDelete