HomeMonday, July 24, 2017, 22:34:44
1

Inserting form data in MySql table

Tuesday, February 10, 15, 13:19:42, 3 Yaers Ago Via wain, Hits: 2278
Inserting form data in MySql table with PHP
Example:
Code:
<?php
include ('db_connect.php');
if(isset($_POST['submit']))
{
$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';
}else{
?>
<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">
</form>
<?php } ?>


Sign In

Sponsor

Related

PHP imagecreate

imagecreate() returns an image identifier representing a blank image of specified size.

Contact Us 2.0. with HTML Page and Pop Up Frame

This is the same Contact Us 2.0. that is in this forum, But I have added more options to this script and a html page with a very nice pop Up frame that DONT get block by any pop Up software. Many websites use this type of script to bypass the blocking…

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.

Smarty Paginate Example - Smarty Pagination with PHP

Smarty Paginate Example, Smarty Pagination with PHP. SmartyPaginate: a class/plugin for data set pagination within the Smarty template environment

PHP Date Examples

Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given.

PHP getdate

Returns an associative array containing the date information of the timestamp, or the current local time if no timestamp is given.

Images In Textarea - CSS

Tutorial Images in Textarea

Preg_Match - PHP Email Validation

Validate email with preg_match in php

PHP filesize

The filesize function returns the size of the specified file.

Creating a basic bad word filter in PHP

This tutorial will show you how to create a basic bad word filter in PHP
About Author

wain

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