Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

PRACTICAL-6

Aim: Write a program to create book master form in php.


Requirements: Xampp server, notepad , browser
Program:
<?php
echo"
<h3><u>BOOK MASTER DETAILS</u></h3>
<div style='float:left; width:100px'>
<table style='border-style:dotted;'>
<tr> <td>Menu</td></tr>
<tr> <td><a href='index.html'>Add Books</a></td></tr>
<tr> <td><a href='#'>View Books</a></td></tr>
</table>
</div>

<h4>Enter book details</h4>


<form action=bookmaster.php method=POST>
<tr>
<td><label>Book Name: </label>
<input type=text name=b_name></input></td>
</tr>
<tr>
<td><label>Author Name: </label>
<input type=text name=Au_name></input></td>
</tr>
<tr>
<td><label>Price: </label>
<input type=text name=price></input></td>
</tr>
<tr>
<td><input type=submit value=Add_Book></td>
<td><input type='reset' ></td>
</from>
";

$bookname=$_POST['b_name'];
$Auname=$_POST['Au_name'];
$price=$_POST['price'];
echo "<br>
<table>
<tr><td>
$bookname added succesfully...<br></td></tr>
<tr><td>
Author name is $Auname <br></td></tr>
<tr><td>
The price is $price</td></tr>
</table>
";
?>
OUTPUT:
PRACTICAL-7

Aim: Write a program to perform Form Validation -Railway ticket reservation


Requirements: Desktop/Laptop, Xampp server, notepad , browser.
Program:
<?php
echo "<center><h1>..Railyway ticket reservation from..</h1>
<form action=validationForm.php method=POST>
Name:<br><input type='text' name='name'>
<br>Address:<br><input type='text' name='address'>
<br>Phone Number :<br><input type='text' name='number'>
<br>Email :<br><input type='text' name='email'>
<br>Number of ticket:<br><input type='text' name='num_people'>
<br>Reservation Quota :<br><input type='text' name=quota>
<br>Train Number :<br><input type='text' name=t_name>
<br>Journey From :<br><input type='text' name=t_from>
<br>Journey To :<br><input type='text' name=t_to>
<br>Class :<br><input type='text' name=class>
<br>Departure :<br><input type='date' name=date>
<br><input style='margin:5px' type=submit value='Book'>
</form></center>
";
$quota=$_POST["quota"];
$tname=$_POST["t_name"];
$from=$_POST['t_from'];
$to=$_POST['t_to'];
$date=$_POST['date'];
$name=$_POST['name'];
$num=$_POST['num_people'];
echo "Dear,$name your reservation of $tname from $from to $to for $num of
people for date $date have been booked succesfully!!";
?>

OUTPUT :

You might also like