practical - Week 6

2023-08-23

Practical 1: Generate an html table in the output below using the array given below

$cars = array (
  array("Volvo",22,18),
  array("BMW",15,13),
  array("Saab",5,2),
  array("Land Rover",17,15)
);

Practical 2: Create a php program to read item form input field (array notation) and show them using indexed array

<html>
<head></head>
<body>
  
<form action="...." method="post">
  <input name="..." value="Arun" />
  <input name="..." value="25" />
  <input name="..." value="BCA" />
  <input type="submit" value="submit">
</form>
  
<?php
// output a single value
echo ...;

// receive all data in an array
$fields = ......
   
// output or process all data
foreach (...) {
  echo $value;
}
?>    
</body>

</html>

Practical 3: Create a php program to read item form input field and show them using associative array

<form action="..." method="post">
  <input name="...[firstname]" value="arun" />
  <input name="...[age]" value="25" />
  <input name="...[course]" value="BCA" />
</form>
  
// receive all data in an array
$fields = 
  
// read out fields by names
$firstname  = $student['firstname'];
$familyname = $student['age'];
$password   = $student['course'];  


// output or process all data
foreach (...) {
  echo $key, $value;
}