|
 |
|
ทำยังไงให้ค่าที่ส่งมาอยู่ในช่อง textbox หน้าล็อกอิน |
|
 |
|
|
 |
 |
|
$name = $_SESSION['login'];
echo"<center><h3>Welcome user : $customer_name</h3><br>";
ไมมันไ่ม่เหมือนกัน
อยากให้มันอยู่ใน textbox ก็ใส่ไปใน value ของ textbox
<input type="text" value="<?php echo $name; ?>" />
|
 |
 |
 |
 |
Date :
2010-09-25 18:33:07 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
session_start();
<?php
mysql_query("SET NAMES UTF8");
$name = $_SESSION['login'];
echo"<center><h3>Welcome user : <input type="text" value="<?php echo $name; ?>" /></h3><br>";
?>
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\AppServ\www\login\s_user.php on line 8
ไมไ่ด้อ่าีพี่
|
ประวัติการแก้ไข 2010-09-25 19:08:05
 |
 |
 |
 |
Date :
2010-09-25 19:05:51 |
By :
beer656 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แนะนำให้ไปดูพื้นฐานใหม่นะครับ นี่มันอยู่ใน tag php อยู่แล้วจะใส่เข้าไปอีกทำไมครับ
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
session_start();
<?php
mysql_query("SET NAMES UTF8");
$name = $_SESSION['login'];
echo"<center><h3>Welcome user : <input type=\"text\" value=\"" . $name ."\" /></h3><br>";
?>
|
 |
 |
 |
 |
Date :
2010-09-25 20:47:36 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือตอนนี้ ทำหน้าล็อกอิน แล้วอยากให้ชื่อมาแสดงที่ textbox แต่มันดันไม่แสดง มันไปแสดง username แล้วมันก็error session ด้วย
หน้ารับล็ฮกอิน
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
if(empty($_POST['username']) || empty($_POST['password'])){
echo"<b>Fill All Detail </b>";
exit;
}
else{
$username=$_POST['username'];
$password=$_POST['password'];
$customer_name=$_POST['customer_name'];
$conn=mysql_connect("localhost","root","mysql") or die("could not connect");
mysql_select_db("project") or die ("could not select database");
mysql_query("SET NAMES UTF8");
$query="select * from customer where username='$username' and password='$password' " ;
$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {
$customer_name = $row["customer_name"];
}
$result=mysql_query($query) or die(mysql_error());
$count=mysql_num_rows($result);
if($count==1){
echo"<b> $customer_name login successfully</b><br>";
$_SESSION['login']= $username;
$_SESSION['password']= $password;
$_SESSION['customer_name'] = $customer_name;
echo"SET Cookie to login:$username,password:$password<br>";
echo"<a href=\"s_user.php\">User detail</a><br>";
echo"<a href =\"s_logout.php\">Logout</a>";
}
else{
echo"<b>User $username Authentication Failed<b><br>";
echo"<a href=\"index.php\">login again</a>";
}
}
?>
หน้าแสดงชื่อ
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
session_start();
<?php
session_start();
mysql_query("SET NAMES UTF8");
$customer_name = $_SESSION['customer_name'];
echo"<center><h3>Welcome user : <input type=\"text\" value=\"" . $customer_name ."\" /></h3><br>";
?>
|
 |
 |
 |
 |
Date :
2010-09-25 23:19:27 |
By :
beer656 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
session_start();
mysql_query("SET NAMES UTF8");
$customer_name = $_SESSION['customer_name'];
echo"<center><h3>Welcome user : <input type=\"text\" value=\"" . $customer_name ."\" /></h3><br>";
?>
ลองเอา session_start(); //ไว้บรรทัดบนสุดครับ
Code (PHP)
echo $customer_name = $_SESSION['customer_name']; //ดูว่าเป็นชื่อที่ต้องการหรือยัง
|
 |
 |
 |
 |
Date :
2010-09-26 00:00:03 |
By :
iieszz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับ
|
 |
 |
 |
 |
Date :
2010-09-26 02:08:47 |
By :
beer656 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|