PHP Application--new record to MySQL table

Source: Internet
Author: User
Tags insert sql mysql
Mysql| Application Example

One, insert.htm Source:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title>Insert</title>

<body>
<p>score Data Sheet--new record
</p>
&LT;P&GT;&LT;HR noshade></p>
<form name= "Form1" method= "Post" action= "insert.htm" >
<table width= border= "0" align= "center" >
<tr>
<td>Number</td>
<td><input type= "text" name= "number" ></td>
</tr>
<tr>
<td>Name</td>
<td><input type= "text" name= "name" ></td>
</tr>
<tr>
<td>Chinese</td>
<td><input type= "text" name= "Chinese" ></td>
</tr>
<tr>
<td>English</td>
<td><input type= "text" name= "中文版" ></td>
</tr>
<tr>
<td>Math</td>
<td><input type= "text" name= "Math" ></td>
</tr>
<tr>
<td><input type= "Submit" name= "Submission" value= "submitted" ></td>
<td> </td>
</tr>
</table>
</form>
&LT;HR noshade>

</body>

Second, insert.php Source:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title>insert</title>

<body>
<?php
Mysql_connect ("ftp", "Root", "");
mysql_select_db ("test");
$sql = "INSERT INTO score (Number,name,chinese,english,math) VALUES ($Number, ' $Name ', $Chinese, $English, $Math)";
mysql_query ($sql);
?> new information to succeed, <a href= "insert.htm" > Please back </a>!
</body>

SQL statements used: INSERT INTO score (Number,name,chinese,english,math) VALUES ($Number, ' $Name ', $Chinese, $English, $Math)



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.