⚙ Start At the Beginning of script
<?php
error_reporting();
Your script/code goes here....
?>
<?php
error_reporting();
Your script/code goes here....
?>
Learn PHP programming A blog for beginners to advance their skills in programming.
1. Step-1
click on help from menu bar
2. Step-2
click on insert license
3. Step-3
Copy this Whole code given Below From BEGIN LICENSE to END LICENSE —– BEGIN LICENSE —– | ||
sgbteam | ||
Single User License | ||
EA7E-1153259 | ||
8891CBB9 F1513E4F 1A3405C1 A865D53F | ||
115F202E 7B91AB2D 0D2A40ED 352B269B | ||
76E84F0B CD69BFC7 59F2DFEF E267328F | ||
215652A3 E88F9D8F 4C38E3BA 5B2DAAE4 | ||
969624E7 DC9CD4D5 717FB40C 1B9738CF | ||
20B3C4F1 E917B5B3 87C38D9C ACCE7DD8 | ||
5F7EF854 86B9743C FADC04AA FB0DA5C0 | ||
F913BE58 42FEA319 F954EFDD AE881E0B | ||
—— END LICENSE —— Step-4 Paste the whole key in place of insert licence begin with From BEGIN LICENSE to END LICENSE |
1. Form.php
<form action="insert.php" method="post" enctype="multipart/form-data">
<p>First Name:<input type="text" name="first" placeholder="First Name">
Last Name:<input type="text" name="last" placeholder="Last Name"></p>
<p>Email:<input type="email" name="email" placeholder="Email">
Mobile:<input type="tele" name="mobile" placeholder="Mobile"></p>
<p>
Gender:
Male<input type="radio" name="gender" value="Male" >
Female<input type="radio" name="gender" value="Female" >
</p>
<p>Hobbies:
Singing <input type="checkbox" name="hobbies[]" value="Singing">
Dancing <input type="checkbox" name="hobbies[]" value="Dancing">
Art <input type="checkbox" name="hobbies[]" value="Art">
cricket <input type="checkbox" name="hobbies[]" value="Cricket"><br>
</p>
<p>
<textarea name="Message" rows="5" cols="40" placeholder="Enter Message">
</textarea>
<!__<input type ="file" name="upload"><!__<br>
<input type="submit" name="submit" value="Submit" >
</p>
<br><a href="select.php" type="submit" name="logout">Show</a>
</form>
2. db.php
<?php
$servername="localhost";
$username="root";
$password="123456789";
$db_name="database_name";//your database Name
$connection=mysqli_connect($servername,$username,$password,$db_name);
// Check connection
if (!$connection) {
die("Connection failed: " . mysqli_connect_error());
}
//echo "Connected successfully";
?>
3. insert.php
<?php
require "db.php";//for database connection
if (isset($_POST['submit'])){ $first=$_POST['first'];
$last=$_POST['last'];
$email=$_POST['email'];
$mobile=$_POST['mobile'];
$gender=$_POST['gender'];
$hobbies=$_POST['hobbies'];
$arr=implode(",",$hobbies);
$message=$_POST['Message'];
//******************************INSERT QUERY START HERE******************************
$query="INSERT INTO forms(first_name,last_name,email,mobile,gender,hobbies,message)
VALUES('$first','$last','$email','$mobile','$gender','$arr','$message')";
$insert=mysqli_query($connection,$query);
if (!$insert==0){
echo "Record inserted Successfully";
}
else
{
echo "validations Failed";
}
}
?>
4. select.php
<table align="center" >
<table style="width:900px;"border="5" >
<tr><th colspan="9"><h1>Records</h1></th></tr>
<tr align="center">
<td><h3>ID</h3></td>
<td><h3>FIRST NAME</h3></td>
<td><h3>LAST NAME</h3></td>
<td><h3>EMAIL</h3></td>
<td><h3>MOBILE</h3></td>
<td><h3>GENDER</h3></td>
<td><h3>HOBBIES</h3></td>
<td><h3>MESSAGE</h3></td>
<td><h3>ACTION</h3></td>
</tr>
<?php
//require "db.php";
//if(isset($_POST['submit'])){
include('db.php');
$select= "SELECT * FROM forms";
$result = mysqli_query($connection,$select);
while($row = mysqli_fetch_array($result)){
?> <tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['first_name'];?></td>
<td><?php echo $row['last_name'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['mobile'];?></td>
<td><?php echo $row['gender'];?></td>
<td><?php echo $row['hobbies'];?></td>
<td><?php echo $row['message'];?></td>
<td><a href='delete.php?id=<?php echo $row['id']; ?>'>Delete</a></td>
</tr> <?php } ?>
</table>
5. delete.php
<table align="center" >
<table style="width:900px;"border="5" >
<tr><th colspan="9"><h1>Records</h1></th></tr>
<tr align="center">
<td><h3>ID</h3></td>
<td><h3>FIRST NAME</h3></td>
<td><h3>LAST NAME</h3></td>
<td><h3>EMAIL</h3></td>
<td><h3>MOBILE</h3></td>
<td><h3>GENDER</h3></td>
<td><h3>HOBBIES</h3></td>
<td><h3>MESSAGE</h3></td>
<td><h3>ACTION</h3></td>
</tr>
<?php
//require "db.php";
//if(isset($_POST['submit'])){
include('db.php');
$select= "SELECT * FROM forms";
$result = mysqli_query($connection,$select);
while($row = mysqli_fetch_array($result)){
?> <tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['first_name'];?></td>
<td><?php echo $row['last_name'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['mobile'];?></td>
<td><?php echo $row['gender'];?></td>
<td><?php echo $row['hobbies'];?></td>
<td><?php echo $row['message'];?></td>
<td><a href='delete.php?id=<?php echo $row['id']; ?>'>Delete</a></td>
</tr> <?php } ?>
</table>
Cannot redeclare
and that means that the function already exists.exp()
is a built-in function in php.function my_exp($value1,$value2) {
return $value1 ** $value2;
}
echo my_exp(2,8);//prints 256;
pow()
echo pow(2,8);//prints 256