|
|
|
บันทักเวลาของของหน้าสมัครสมาชิกค่ะ รบกวนผู้รู้ช่วยทีค่ะ (หัดทำเว็บค่ะ) |
|
|
|
|
|
|
|
มันบันทึกเวลาแล้วเป็น 0000-00-00 00:00:00 ค่ะ
หน้าสมัครสมาชิก register.php
register.php
<?php
include('conn.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LN_Plastic</title>
</head>
<link rel="stylesheet" type="text/css" href="css/styleindex.css">
<link rel="icon" href="img/icon/icon.jpg" />
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
function checkregis()
{
if(document.getElementById('m_username').value.length ==0){
alert("คุณยังไม่ได้กรอก Username ค่ะ");
return false;
}
if(document.getElementById('m_password').value.length ==0){
alert("คุณยังไม่ได้กรอก Password ค่ะ");
return false;
}
if(document.getElementById('m_fullname').value.length ==0){
alert("คุณยังไม่ได้กรอก ชื่อ-นามสกุล ค่ะ");
return false;
}
if(document.getElementById('m_address').value.length ==0){
alert("คุณยังไม่ได้กรอก ที่อยู่ ค่ะ");
return false;
}
if(document.getElementById('m_email').value.length ==0){
alert("คุณยังไม่ได้กรอก อีเมล์ ค่ะ");
return false;
}
}
</script>
<body>
<div class="galaxy">
<div class="world">
<div class="mainland1">
<?php include('mainland1.inc.php'); ?>
</div><!-- ------------------ปิดmainland1------------------ -->
<div class="mainland2">
<?php include('mainland2.inc.php'); ?>
<!-- ------------------ส่วนเปิดหน้าform login------------------ -->
<div style="height:10px;"></div>
<table width="1020" cellpadding="10" cellspacing="0" border="1" bgcolor="#FFFFFF";>
<tr>
<td>
<table width="995" height="30" cellpadding="0" cellspacing="0" border="1">
<tr>
<td style="border:1px solid #7c7c7c;"><a href="index.php">หน้าแรก</a> >> <span style="color:#8bb35a;">เข้าสู่ระบบ</span></td>
</tr>
</table>
<div style="height:10px;"></div>
<div style="background-color:#000; color:#FFF; width:995px; height:40px; font-size:18px; font-weight:bold;">สมัครสมาชิก</div>
<div style="height:20px;"></div>
<form name="register" action="do_register.php" method="post" >
<?
$m_email = $_POST['m_email'];
?>
<table width="775" height="410" cellpadding="0" cellspacing="20" border="0">
<tr valign="top">
<td width="365" height="270">
<table width="950" height="500" border="0" style="border:1px solid #7c7c7c; padding-left:15px; ">
<tr>
<td><b>Username</b></td>
<td><input type="text" id="m_username" name="m_username" size="20" placeholder="Username" />
<label style="color:#F00;">**</label>
</td>
</tr>
<tr>
<td><b>Password</b></td>
<td><input type="password" id="m_password" name="m_password" size="20" placeholder="••••••••" />
<label style="color:#F00;">** ???? ตัวอักษร</label>
</td>
</tr>
<tr>
<td><b>ชื่อ-นามสกุล</b></td>
<td><input type="text" id="m_fullname" name="m_fullname" size="30" placeholder="ชื่อ-นามสกุล" maxlength="30" />
<label style="color:#F00;">**</label>
</td>
</tr>
<tr>
<td><b>ที่อยู่</b></td>
<td><textarea id="m_address" name="m_address" cols="40" rows="5" placeholder="กรุณากรอกที่อยู่" ></textarea>
<label style="color:#F00;">**</label>
</td>
</tr>
<tr>
<td><b>เบอร์โทรศัพท์</b></td>
<td>
<input type="text" name="m_phone" size="20" maxlength="10" placeholder="0812345678" />
</td>
</tr>
<tr>
<td><b>อีเมล์</b></td>
<td><input type="text" id="m_email" name="m_email" size="30" placeholder="[email protected]" maxlength="30"
value="<? echo $_POST['m_email']; ?>"/>
<label style="color:#F00;">**</label>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="image" name="submit" id="checkregis" onclick="return checkregis();" src="img/button/buttongreen1.jpg"/>
<!--<input type="reset" src="img/button/reset.jpg">-->
<!--<a href="javascript:document.register.reset()"><img src="img/button/reset.jpg" /></a>-->
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<div style="height:15px;"></div>
</div> <!-- ------------------ปิดmainland2------------------ -->
<div class="mainland3">
<?php include("mainland3.inc.php");?>
</div>
<!-- ------------------ปิดmainland3------------------ -->
</div><!-- ปิดworld -->
</div><!-- ปิดgalaxy -->
</body>
</html>[/code]
con.php
[code]<?php
session_start();
$link = mysql_connect("localhost","root","12345");
mysql_query("SET NAMES UTF8");
mysql_select_db("projectdatabase",$link);
?>
do_register.php
<?php
include('conn.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head>
<?php
$sql = " INSERT INTO member SET
m_username = '".$_POST['m_username']."',
m_password = '".$_POST['m_password']."',
m_fullname = '".$_POST['m_fullname']."',
m_address = '".$_POST['m_address']."',
m_phone = '".$_POST['m_phone']."',
m_email = '".$_POST['m_email']."' ";
if(mysql_query($sql,$link)){
// ถ้า Insert สำเร็จ
$_seesion['login'] = true;
$_seesion['m_username'] = $_POST['m_username'];
$_session['m_password'] = $_POST['m_password'];
$_seesion['m_fullname'] = $_POST['m_fullname'];
$_seesion['m_address'] = $_POST['m_address'];
$_seesion['m_phone'] = $_POST['m_phone'];
$_seesion['m_email'] = $_POST['m_email'];
echo "<script language='JavaScript'>
alert('สมัครสมาชิกสำเร็จแล้ว');
window.location.href = 'login.php';
</script>";
?>
<?php
}else{
// ถ้า Insert ไม่สำเร็จ
print mysql_error().'-->'.$sql;
}
?>
</body>
</html>
Tag : PHP, MySQL, HTML/CSS
|
|
|
|
|
|
Date :
2015-02-14 18:14:34 |
By :
jungjung003 |
View :
637 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_date หายไปไหน
$sql = " INSERT INTO member SET
m_username = '".$_POST['m_username']."',
m_password = '".$_POST['m_password']."',
m_fullname = '".$_POST['m_fullname']."',
m_address = '".$_POST['m_address']."',
m_phone = '".$_POST['m_phone']."',
m_email = '".$_POST['m_email']."',
m_date = NOW() ";
หรือ
m_date = date('Y-m-d H:i:s') ";
ปล. $_SESSION
|
ประวัติการแก้ไข 2015-02-14 18:39:35 2015-02-14 18:41:42
|
|
|
|
Date :
2015-02-14 18:32:24 |
By :
sabaitip |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|