Ad block is installed and active. Please support us by disabling it.
HomeWednesday, April 25, 2018, 08:52:15
1

Inserting form data in MySql table

Tuesday, February 10, 15, 13:19:42, 3 Yaers Ago Via wain, Hits: 5971
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

ShoutBox 1.1. PHP Script

ShoutBox allows your users to post short messages on your site. The script is lightweight and very easy to install and use.

Link Generator PHP Script

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

Jquery - Formatting International Phone Numbers

How to format international telephone numbers with jquery

PHP Fwrite : fwrite

php write to file - how to write data to a file using the php frwite function

Upload Image With PHP

[Example3] Tutorial - How to upload image in php.

php Array

These functions allow you to interact with and manipulate arrays in various ways. Arrays are essential for storing, managing, and operating on sets of variables.

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…

PHP explode

Explode — Split a string by string.

MySQL Basic Functions

MySQL Basic Functions - select, delete, update..

How to set up password for phpMyAdmin in Wamp Server

Password for phpMyAdmin in Wamp
About Author

wain

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