HomeFriday, June 23, 2017, 06:59:10

Inserting form data in MySql table

Tuesday, February 10, 15, 13:19:42, 2 Yaers Ago Via wain, Hits: 2099
Inserting form data in MySql table with PHP
include ('db_connect.php');
$data1 = $_POST['data1'];
$data2 = $_POST['data2'];
if (get_magic_quotes_gpc()) {
$data1 = stripslashes($data1);
$data2 = stripslashes($data2);
$data1 = mysql_real_escape_string($data1);
$data2 = mysql_real_escape_string($data2);
//This function is used to create a legal SQL string that you can use in an SQL statement. The given string is //encoded to an escaped SQL string, taking into account the current character set of the connection.
$result = mysql_query("INSERT INTO data (data1,data2)
VALUES ('$data1','data2')")
or die(mysql_error());
echo $data1 . ' - ' . $data2 . ' Ok';
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="data1">
<input type="text" name="data2">
<input type="submit" name="submit" value="Submit">
<?php } ?>

Sign In



Upload and Resize an Image with PHP

Tutorial - How to upload and resize image with PHP

Upload Attachment - PHP Tutorial

Upload attachment with PHP example, Requirement(s): PHP server

Random MySQL Query

Random MySQL query, requirement(s): PHP Server, MySQL

HTML Button Generator

This script will allow your visitors to create HTML Buttons online. To use the "html button generator" script completely free , the "powered by" link at the bottom of the pages must stay intact.

Adodb Recordcount Example

RecordCount returns the number of rows in the record set.

Tell A Friend with Captcha

This form allows your visitors to suggest your site to a friend. It features an HTML email format and an admin notification email.

PHP Redirect

Header (location) redirect must be processed before any output to the browser.

PHP $_POST Function

Collect values from a form sent with method post

Preventing multiple form submissions

Preventing multiple form submissions

Preg_Match - PHP Form Validation

PHP form validation with preg_match
About Author


Date Registered: Sun, Feb 8, 15
Last Time Online: Thu, Jun 15, 17
So far has created 115 entries.
This author has not yet filled in any details.