Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Insert data in to the textbox in PHP Reply To: Insert data in to the textbox in PHP

#168967
dnyanesh
Participant

First of all thanks a lot for your feedback .
i answer of the below question and i know it from W3schools.com and tutorialpoints . my query also resolved . …

Does your database exist yet? (do you know how to create one?)
Does your database table exist yet? (does it have any records in it?)
Do you have a connection to your database? (do you know how to connect to it?)
Do you know how to query the database?
Do you know how to retrieve the results?

Since last week i started learning PHP , HTML and now i am trying to create web page where i can select,update , add and delete on web page it self. i could complete select and add . now i will start coding for update edit and delete.

please guide me to get more knowledge so that i can be perfect.

actually i was working in logistic company (KPO), but wanted to join IT so i left the previous job and now i am in my own field. everyday some or the other thing is new learning in this field . sorry to trouble you.

here is the code for add data in to the table .

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<meta name=”description” content=”” />
<meta name=”keywords” content=”” />
<meta name=”author” content=”” />
<link rel=”stylesheet” type=”text/css” href=”style.css” />
<title>First web page</title>
</head>

<body>

<?php include(‘includes/header.php’); ?>

<?php include(‘includes/nav.php’); ?>

<?php
$con = mysql_connect(“localhost”,”root”,””);
mysql_select_db(“firstweb”);

/*if(isset($con))
{
echo “successfullu”;
}else{ echo mysql_error();}*/
if(isset($_POST[‘sub’]))
{
//$sr_no=$_POST[‘sr_no’];

$name=$_POST[‘name’];
$email=$_POST[’email’];
$date=$_POST[‘date’];
$mobile=$_POST[‘mobile’];
$gender=$_POST[‘gender’];
$lang=$_POST[‘lang’];

$sql=”insert into emp_data values(”,’$name’,’$email’,’$date’,’$mobile’, ‘$gender’,’$lang’)”;
$rec_insert = mysql_query($sql);
if($rec_insert)
{
echo “entered data succesfully”;
}
else
{
echo “entered data not succesfully”.mysql_error();

}
}
?>
<h3>Paragraph Element</h3>

<form action=”” method=”post”>
<table width=”400″ height=”109″ border=”1px solid black” >
<tr>

<td width=”63″>Name</td>
<td width=”169″>E-mail</td>
<td width=”85″>DOB</td>
<td width=”104″>Mobile_No</td>
<td width=”50″>Gender</td>
<td width=”69″>Language</td>
</tr>
<tr id=”bgcolor”>

<td class=”back”><input type=”text” name=”name” /></td>
<td class=”back”><input type=”text” name=”email” /></td>
<td class=”back”><input type=”date” name=”date” /></td>
<td class=”back”><input type=”text” name=”mobile” /></td>
<td class=”back”><input id=”bgcolor” type=”radio” name=”gender” value=”M” checked=”checked”>M</input> <input type=”radio” name=”gender” value=”F”>F</input></td>
<td class=”back”><select name=”lang”><option value=”English” >English</option>
<option value=”Marathi”>Marathi</option>
<option value=”Hindi”>Hindi</option> </select></td>

</tr>
<tr>
<td colspan=”7″><input type=”submit” value=”Submit” name=”sub” /> <input type=”button” value=”Back”/> </td>
</tr>
</table>
</form>

<?php include(‘includes/sidebar.php’); ?>

<?php include(‘includes/footer.php’); ?>

</body>

</html>