Dislay PHP Array data in User understandable Form or in table form

Array

$booking_array = array(
"slots_booked" => $slots_booked,
"booking_date" => $booking_date,
"cost_per_slot" => number_format($cost_per_slot, 2),
"name" => $name,
"email" => $email,
"phone" => $phone
);


using print_r()
<?php
print_r('<pre>');
print_r($booking_array);
print_r('</pre>');
?>
output :
Array
(
    [slots_booked] => 13:00:00|
    [booking_date] => 2015-06-28
    [cost_per_slot] => 20.50
    [name] => sdsafd
    [email] => ssiii@gmail.com
    [phone] => 9898989898
)
In User Understandable table form

<?php
echo 'Your Deatils'. '<br/><br/>';
echo 'Appointment Time' . $slots_booked .'<br/>';
echo 'Appointment Date' . $booking_date .'<br/>';
echo 'Appointment Cost' . $cost_per_slot .'<br/>';
echo 'Your Name' . $name .'<br/>';
echo 'Your Email' . $email .'<br/>';
echo 'your Phone' . $phone .'<br/>';
echo '<br/>';
?>

output : Your Deatils

Appointment Time13:00:00|
Appointment Date2015-06-28
Appointment Cost20.50
Your Namesdsafd
Your Emailssiii@gmail.com
your Phone9898989898


In Table form

<?php            
  echo"<table width='600' border='1'>";
echo"<tr bgcolor='#EEFFFF'>";
echo"<td>Appointment Time</td>";
echo"<td>$slots_booked </td>";
echo"</tr>";
echo"<tr bgcolor='#FFEEFF'>";
echo"<td>Appointment Date</td>";
echo"<td>$booking_date</td>";
echo"</tr>";
echo"<tr bgcolor='#EEFFFF'>";
echo"<td>Appointment Cost</td>";
echo"<td>$cost_per_slot </td>";
echo"</tr>";
echo"<tr bgcolor='#FFEEFF'>";
echo"<td>Your Name</td>";
echo"<td>$name</td>";
echo"</tr>";
echo"<tr bgcolor='#EEFFFF'>";
echo"<td>Your Email</td>";
echo"<td>$email </td>";
echo"</tr>";
echo"<tr bgcolor='#FFEEFF'>";
echo"<td>Your Phone No</td>";
echo"<td>$phone</td>";
echo"</tr>";
echo"</table>";
?>

output:


Appointment Time12:00:00|
Appointment Date2015-06-26
Appointment Cost20.50
Your Nameccscf
Your Emailsfsfs
Your Phone Nosffsf

Comments

Popular posts from this blog

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

Hyperledger Development with in 10 days — Day 6

Insert CheckBox and Radio button Data in MySQL Database Using PHP