PHP ExtJS MySQL Implementation user Registration application

Source: Internet
Author: User

<?php Tutorial
if ($_post[' password ']!=$_post[' Repassword '])
{
//Do not execute store
exit;
}
$conn =mysql tutorial _connect ("localhost", "root", "123");
mysql_select_db ("Db_register");
$sql = INSERT INTO Tb_register (reg_loginid,reg_name,reg_id,reg_password,reg_sex,reg_address)
values (' ". $_ post[' login ']. "', '". $_post[' name ']. "', '. $_post[' id '." ', ' ". $_post[' password '." ', ' "
. $_post[' sex ']. _post[' address '].
if (mysql_query ($sql, $conn))
{
echo "registered successfully";
}
Else
{
echo failed to register;
}
Mysql_close ($conn);
?

<title> Registration </title>
<link rel= "stylesheet" type= text/css Tutorial "href=". /ext/resources/css/ext-all.css "/>
<script type= "Text/javascript Tutorial" src= ". /ext/adapter/ext/ext-base.js "></script>
<script type= "Text/javascript" src= ". /ext/ext-all.js "></script>
<script type= "Text/javascript" src= "Register.js" ></script>
<body>
</body>

Database Tutorial Structure


Create Database Db_register;
CREATE TABLE Db_register.tb_register (
Reg_loginid varchar () primary key,
Reg_name varchar is not NULL,
reg_id int NOT NULL,
Reg_password varchar is not NULL,
Reg_sex varchar (2),
reg_address varchar (50)
);

ExtJS file


Ext.onready (function () {
function Registerhandler () {
var values = ext.getcmp ("form"). GetForm (). GetValues (); Get TextField, radio equivalents in form
Ext.Ajax.request ({
URL: ' save.php ',
Success:function () {Ext.Msg.alert ("Success");},
Method: "Post",
Failure:function () {Ext.Msg.alert ("failure");},
Params:values
});
}
var form = new Ext.form.FormPanel ({
ID: ' Form ',
Basecls: ' X-plain ',
Layout: ' Absolute ',
url:http://www.111cn.net/phper/21/' save-form.php ',
DefaultType: ' TextField ',
Items: [{
x:0,
y:0,
Xtype: ' label ',
Text: ' Login account: '
},{
X:80,
y:0,
Name: ' Login ',
Anchor: ' 100% '
},{
x:0,
Y:30,
Xtype: ' label ',
Text: ' User name: '
},{
X:80,
Y:30,
Name: ' Name ',
Anchor: ' 100% ',
},{
x:0,
Y:60,
Xtype: ' label ',
Text: ' ID number: '
},{
X:80,
Y:60,
Name: ' ID ',
Anchor: ' 100% ',
},{
x:0,
Y:90,
Xtype: ' label ',
Text: ' User password: '
},{
X:80,
Y:90,
InputType: ' Password ',
Name: ' Password ',
Anchor: ' 100% ',
},{
x:0,
Y:120,
Xtype: ' label ',
Text: ' Password confirmation: ',
},{
X:80,
Y:120,
Name: ' Repassword ',
InputType: ' Password ',
Anchor: ' 100% ',
},{
X:80,
y:150,
Xtype: ' Radio ',
Name: ' Sex ',
Fieldlabel: ' Sex ',
Boxlabel: ' Male ',
Inputvalue: ' B '//radio value is: b
},{
x:0,
y:152,
Xtype: ' label ',
Text: ' Sex: '
},{
x:140,
y:150,
Xtype: ' Radio ',
Name: ' Sex ',
Fieldlabel: ' Sex ',
Boxlabel: ' Female ',
Inputvalue: The value of ' G '//radio is: g
},{
x:0,
y:180,
Xtype: ' label ',
Text: ' User address '
},{
X:80,
y:180,
Name: ' Address ',
Anchor: ' 100% '
}]
});
var window = new Ext.window ({
Title: ' Registered account ',
width:400,
HEIGHT:300,
minwidth:400,
MINHEIGHT:300,
Layout: ' Fit ',
Plain:true,
Bodystyle: ' padding:5px; ',
Buttonalign: ' Center ',
Items:form,
Buttons: [{
Text: ' Register ',
Handler:registerhandler
},{
Text: ' Cancel '
}]
});
Window.show ();
});

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.