I am newbie in PHP
I wish someone who can assist me on my first project
my first project name is websticker and it is about inserting of information and it can also view in any browser
I have a database MySQL and i can connect without any errors
my first plan is how to make continue where end user can able to add new data without redirecting to other page.
i have two file which is insert.html and insert.php. In the insert.html when end user add new data and submit it will redirect to insert.php and prompt the 1 record added
what i want is, In the same page and message will prompt without redirecting and can also add new data.
for example:
insert.html
- Code: Select all
<html>
<body>
<form action="insert.php" method="post">
ID: <input type="text" name="de_id">
Part Number: <input type="text" name="de_prtno">
Size by ": <input type="text" name="de_inch">
<input type="submit" name="submit">
</form>
</body>
</html>
for insert.php
- Code: Select all
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("db_webstickerdemo", $con);
if(isset($_POST['submit'])) {
$sql="INSERT INTO tblde_sticker (de_id, de_prtno, de_inch)
VALUES
('$_POST[de_id]','$_POST[de_prtno]','$_POST[de_inch]')";
if (!mysql_query($sql,$con))
die('Error: ' . mysql_error());
header('Location: insert.php');
}
echo "1 record added";
mysql_close($con);
?>
i hope some can understand my english.
Thanks


