|
|
|
Edit profile.php ไม่ได้ ผมเอา Form มาให้ดูก่อน มัน Update ไม่ได้ใน SQL ไม่รู้ทำไงอ่าาาา |
|
|
|
|
|
|
|
ผมเอา Form มาให้ดูก่อน
มัน Update ไม่ได้ใน SQL ไม่รู้ทำไงอ่าาาา
รบกวน ด้วย
Code (PHP)
<?php
session_start();
if (!(isset($_SESSION['s_user'])) || empty($_SESSION['s_user'])) {
echo "<script>
alert('SystemError.Please Login');
window.location='formlogin.php';
</script>";
exit();
}
?>
<!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>Edit Profiler : : : Manhattan</title>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script><style type="text/css">
<!--
body {
background-image: url(Image/BG.jpg);
}
.style7 {color: #FFFFFF}
.style8 {font-size: 36px}
.style9 {font-size: 20px}
-->
</style></head>
<body onload="MM_preloadImages('Image/Btn/Page1_2.jpg','Image/Btn/btnProduct_2.jpg','Image/Btn/btnSale_2.jpg','Image/Btn/btnMoney_2.jpg','Image/Btn/btnLogin_2.jpg')">
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bordercolor="#FFFFFF">
<td bordercolor="#FFFFFF"><p align="left">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','800','height','160','src','Menu','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','Menu' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="800" height="160">
<param name="movie" value="Menu.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="Menu.swf" width="800" height="160" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
</object>
</noscript>
</p>
<?php
include ("connect.php");
$username = $_SESSION['s_user'];
$sql="select * from profile where username = '$username'";
$result = mysql_query($sql) or die ('SQL error');
$row_user = mysql_fetch_array($result);
?>
<form id="form1" name="form1" method="post" action="addprofile.php">
<table width="482" border="1" align="center" bordercolor="#FF9900">
<tr>
<td colspan="2" bordercolor="#000000" bgcolor="#FF6633"><div align="center" class="style7">
<p class="style8"><br />
Edit Profile<br />
<br />
</p>
</div></td>
</tr>
<tr>
<td width="176" bordercolor="#000000" bgcolor="#FF6633"><div align="left" class="style7"><span class="style9">Username</span></div></td>
<td width="290" bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label>
<input name="username" type="text" id="username" value="<?=$row_user[0]?>" />
</label>
</span></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF6633"><div align="left" class="style7"><span class="style9">OldPassword</span></div></td>
<td bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label>
<input name="oldpassword" type="password" id="oldpassword" value="<?=$row_user[1]?>" />
</label>
</span></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF6633"><span class="style7"><font size="3" face="Verdana, Arial, Helvetica, sans-serif">New
Password</font></span></td>
<td bordercolor="#000000" bgcolor="#FF6633"><font color="#000000" size="3" face="Verdana, Arial, Helvetica, sans-serif">
<input name="password" type="password" id="password" />
</font></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF6633"><div align="left" class="style7"><span class="style9">Re-Newpassword</span></div></td>
<td bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label>
<input type="password" name="repassword" id="repassword" />
</label>
</span></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF6633"><div align="left" class="style7"><span class="style9">Name</span></div></td>
<td bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label>
<input name="name" type="text" id="name" value="<?=$row_user[2]?>" />
</label>
</span></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF6633"><div align="left" class="style7"><span class="style9">Surname</span></div></td>
<td bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label>
<input name="sname" type="text" id="sname" value="<?=$row_user[3]?>" />
</label>
</span></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF6633"><div align="left" class="style7"><span class="style9">Address</span></div></td>
<td bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label>
<textarea name="address" id="address" cols="45" rows="5"><?=$row_user[4]?>
</textarea>
</label>
</span></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF6633"><div align="left" class="style7"><span class="style9">Phone</span></div></td>
<td bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label>
<input name="tel" type="text" id="tel" value="<?=$row_user[5]?>" />
</label>
</span></td>
</tr>
<tr>
<td bordercolor="#000000" bgcolor="#FF6633"><div align="left" class="style7"><span class="style9">E-Mail</span></div></td>
<td bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label>
<input name="email" type="text" id="email" value="<?=$row_user[6]?>" />
</label>
</span></td>
</tr>
<tr>
<td colspan="2" bordercolor="#000000" bgcolor="#FF6633"><span class="style7">
<label> </label>
</span> <label><div align="center" class="style7"> <br />
<input type="submit" name="button" id="button" value="Submit" />
<input type="reset" name="button2" id="button2" value="Reset" />
<br />
<br />
</div>
</label></td>
</tr>
</table>
</form>
<p align="left"> </p>
<p align="center">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','800','height','160','src','menu2','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','border','5','wmode','transparent','movie','menu2' ); //end AC code
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="800" height="160">
<param name="movie" value="menu2.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="menu2.swf" width="800" height="160" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" border="5" wmode="transparent"></embed>
</object>
</noscript>
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','800','height','50','src','Image/comment','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','Image/comment' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="800" height="50">
<param name="movie" value="Image/comment.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="Image/comment.swf" width="800" height="50" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
</object>
</noscript>
</p></td>
</tr>
</table>
<blockquote> </blockquote>
<br />
</body>
</html>
เอานี้ editpro......php
Code (PHP)
<?php
session_start();
include ("connect.php");
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$repassword = trim($_POST['repassword']);
$name = $_POST ['name'];
$sname = $_POST['sname'];
$address = $_POST['address'];
$tel = $_POST['tel'];
$email = $_POST['email'];
// checknull
function checknull($var,$value)
{
if (empty($var)){
echo"<script>
alert('Please Input ".$value."');
history.back();
</script>";
exit();
}
}
checknull ($email,"email");
checknull ($username,"username");
// update
$sql="update profile set password ='$password',name ='$name', sname = '$sname', address = '$address', tel = '$tel', email = '$email' ";
if (!empty($password))
{
$sql.="password='$password'";
}
$sql.="where username ='$username'";
mysql_query($sql) or die ("Update Error!!!");
echo"<script>
alert('Save Data OK');
</script>";
echo"<center> <a href = 'editprofile.php'>
FORM EDIT </a></center>" ;
?>
Tag : - - - -
|
|
|
|
|
|
Date :
2009-03-25 16:54:28 |
By :
meraiwa |
View :
5069 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $sql
ออกมาเทสยังครับ
|
|
|
|
|
Date :
2009-03-25 22:10:08 |
By :
rasabut |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
สามารถนำมาใช้ได้เลยหรือป่าวครับ
|
|
|
|
|
Date :
2009-07-26 00:07:35 |
By :
zillie |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<form id="form1" name="form1" method="post" action="addprofile.php">
ตกลงให้ไปหน้า addprofile หรือ editprofile ครับ
|
|
|
|
|
Date :
2009-07-27 20:12:28 |
By :
amuropao08 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|