|
 |
|
$_POST มีปัญหาค่ะ กด ค้าหาโดย $_GET แล้ว $_POST หาย มีรูปค่ะ ติดมาหลายวันแล้วค่ะ ช่วยที |
|
 |
|
|
 |
 |
|
ติดมาหลายวันแล้วค่ะ ช่วยทีค่ะ เพื่อนๆเค้าสอบ project กัมหมดแล้วเรายังไม่ถึงไหนเลย
คำถาม
$_POST มีปัญหาค่ะ กด ค้าหาโดย $_GET แล้ว $_POST จากหน้าที่ 1 แล้วหาย
หน้าที่ 1

หน้าที่ 2                                    

หน้าที่ 2                                    

หน้าที่ 2                                    

code หน้าที่ 1
Code (PHP)
<?php
session_start() ;
if(!session_is_registered("login_true_as")) {
echo "<meta http-equiv='refresh' content='0;url=../as/login.php'>" ;
exit() ;
}
?>
<html>
<head>
<title>ระบบคลินิกทันตกรรม</title>
<style type="text/css">
<!--
BODY {font-family:;font-size="10"}
A:link {text-decoration: none; color: blue }
A:visited {text-decoration: none; color: blue }
A:hover {text-decoration: none; color: darkorange }
A:active {text-decoration: none; color: blue }
p, div, td, ul li, ol li { font-family: MS Sans Serif, Microsoft Sans Serif; font-size: 10pt }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body>
<a href="../as/register_pt.php"><IMG SRC="../img/3.gif"BORDER="0">
<a href="../as/manage_pt.php"><IMG SRC="../img/6.gif"BORDER="0">
</a>
<hr>
<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
ต้องการค้นหา
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
จาก
<select name="fields">
<option value="user_code">รหัสผู้ป่วย</option>
<option value="user_name">ชื่อ</option>
<option value="user_sname">นามสกุล</option>
<option value="user_day">วันเกิด</option>
<option value="user_mon">เดือนเกิด</option>
<option value="user_year">ปีเกิด</option>
<option value="user_sex">เพศ</option>
<option value="user_address">ที่อยู่</option>
<option value="user_call">โทรศัพย์</option>
<option value="user_call2">มือถือ</option>
<option value="user_intolerance">แพ้ยา</option>
<option value="user_disease">โรคประจำตัว</option>
</select>
<input type="submit" name="Submit" value="ค้นหา">
</form>
<hr>
<?
$jb_d = date("d");
$jb_m = date("m");
$jb_y = date("Y");
$jb_y2=$jb_y+543;
$jb_time=date("H:i:s");
$job_day="$jb_d/$jb_m/$jb_y2 เวลา $jb_time";
$time=date("YmdHis");
?>
<form action="choice_dc_step_2.php" method="post" name="form1">
<td width="104">วันเปิดงาน</td>
<td width="221" bgcolor="#CCCCCC"><input type="job_day" value="<?echo"$job_day"?>" readonly></td>
<input type="hidden" name="job_day" value="<?=$job_day; ?>">
</tr><br>
<td width="104">รหัสเปิดงาน</td>
<td width="221" bgcolor="#CCCCCC"><input type="jb_code" value="job<?=$time;?>" readonly></td>
<input type="hidden" name="job_code" value="job<?=$time; ?>">
</tr><br>
<?
$fields=$_GET["fields"];
if($_GET["txtKeyword"] != "")
{
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("fun");
mysql_query("SET NAMES 'tis620'");
// Search By Name or Email
$strSQL = "SELECT * FROM tb_user WHERE (user_status='pt' and $fields LIKE '%".$_GET["txtKeyword"]."%') ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 10; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by user_code ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
<table width="900" border="1" align="center">
<tr bgcolor="#CCCCCC">
<th width="150"> <div align="center">เลือก</div></th>
<th width="150"> <div align="center">รหัสผู้ป่วย</div></th>
<th width="200"> <div align="center"> ชื่อ</div></th>
<th width="200"> <div align="center"> นามสกุล </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><input type="RADIO" name="user_code" value="<?=$objResult["user_code"];?>" CHECKED><br></a></center></td>
<td><?=$objResult["user_code"];?></div></td>
<td><center><?=$objResult["user_name"];?></a></center></td>
<td><center><?=$objResult["user_sname"];?></a></center></td>
<?
}
?>
</table>
<br>
พบ <?= $Num_Rows;?> ค้นหา : หน้า <?=$Num_Pages;?> :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]&fields=$_GET[fields]'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]&fields=$_GET[fields]'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]&fields=$_GET[fields]'>Next>></a> ";
}
mysql_close($objConnect);
}
?>
<?
if($_GET["txtKeyword"] == "")
{
mysql_connect('localhost','root','1234'); // connect mysql
mysql_select_db('fun'); // select database
mysql_query("SET NAMES 'tis620'");
if(!isset($start)){
$start = 0;
}
$limit = '10'; // แสดงผลหน้าละกี่หัวข้อ
$Qtotal = mysql_query("select * from tb_user where user_status = 'pt'"); //คิวรี่ คำสั่ง
$total = mysql_num_rows($Qtotal); // หาจำนวน record
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("fun");
$strSQL = "SELECT * FROM tb_user where user_status = 'pt' ORDER BY user_code DESC LIMIT $start,$limit ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$totalp = mysql_num_rows($objQuery); // หาจำนวน record ที่เรียกออกมา
?>
<table width="900" border="1" align="center">
<tr bgcolor="#CCCCCC">
<th width="150"> <div align="center">เลือก</div></th>
<th width="150"> <div align="center">รหัสผู้ป่วย</div></th>
<th width="200"> <div align="center"> ชื่อ</div></th>
<th width="200"> <div align="center"> นามสกุล </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><input type="RADIO" name="user_code" value="<?=$objResult["user_code"];?>" CHECKED><br></a></center></td>
<td><?=$objResult["user_code"];?></div></td>
<td><center><?=$objResult["user_name"];?></a></center></td>
<td><center><?=$objResult["user_sname"];?></a></center></td>
<?
}
/* ตัวแบ่งหน้า */
$page = ceil($total/$limit); // เอา record ทั้งหมด หารด้วย จำนวนที่จะแสดงของแต่ละหน้า
/* เอาผลหาร มาวน เป็นตัวเลข เรียงกัน เช่น สมมุติว่าหารได้ 3 เอามาวลก็จะได้ 1 2 3 */
for($i=1;$i<=$page;$i++){
if($_GET['page']==$i){ //ถ้าตัวแปล page ตรง กับ เลขที่วนได้
echo "[<a href='?start=".$limit*($i-1)."&page=$i'><B>$i</B></A>]"; //ลิ้งค์ แบ่งหน้า เงื่อนไขที่ 1
}else{
echo "[<a href='?start=".$limit*($i-1)."&page=$i'>$i</A>]"; //ลิ้งค์ แบ่งหน้า เงื่อนไขที่ 2
}
}
?>
<?
?>
</table>
<?
}
?>
<input name="btnSubmit" type="submit" value="Submit">
</body>
</html>
code หน้าที่ 2
Code (PHP)
<?php
session_start() ;
if(!session_is_registered("login_true_as")) {
echo "<meta http-equiv='refresh' content='0;url=../as/login.php'>" ;
exit() ;
}
?>
<?php
$user_pt_code=$_POST["user_code"];
include("config.inc.php") ;
mysql_connect($hostname, $user, $password) or die("ติดต่อฐานข้อมูลไม่ได้");
mysql_select_db($dbname) or die("เลือกฐานข้อมูลไม่ได้");
mysql_query("SET NAMES 'tis620'");
$tblname='tb_user';
$result = mysql_query("select * from $tblname where user_code='$user_pt_code'") or die ("Err Can not to result") ;
$dbarr = mysql_fetch_array($result) ;
$pt_code=$dbarr['user_code'] ;
$pt_name=$dbarr['user_name'] ;
$pt_sname=$dbarr['user_sname'] ;
$job_day=$_POST["job_day"];
$job_code=$_POST["job_code"];
$job_day=$_POST["job_day"];
$job_code=$_POST["job_code"];
echo"$job_day<p>";
echo"$job_code<p><hr>";
echo"$pt_code<p>";
echo"$pt_name<p>";
echo"$pt_sname<p>";
?>
<html>
<head>
<title>ระบบคลินิกทันตกรรม</title>
<style type="text/css">
<!--
BODY {font-family:;font-size="10"}
A:link {text-decoration: none; color: blue }
A:visited {text-decoration: none; color: blue }
A:hover {text-decoration: none; color: darkorange }
A:active {text-decoration: none; color: blue }
p, div, td, ul li, ol li { font-family: MS Sans Serif, Microsoft Sans Serif; font-size: 10pt }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body>
<a href="../as/register_pt.php"><IMG SRC="../img/3.gif"BORDER="0">
<a href="../as/manage_pt.php"><IMG SRC="../img/6.gif"BORDER="0">
</a>
<hr>
<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
ต้องการค้นหา
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
จาก
<select name="fields">
<option value="user_code">รหัสทันตแพทย์</option>
<option value="user_name">ชื่อ</option>
<option value="user_sname">นามสกุล</option>
<option value="user_day">วันเกิด</option>
<option value="user_mon">เดือนเกิด</option>
<option value="user_year">ปีเกิด</option>
<option value="user_sex">เพศ</option>
<option value="user_address">ที่อยู่</option>
<option value="user_call">โทรศัพย์</option>
<option value="user_call2">มือถือ</option>
</select>
<input type="submit" name="Submit" value="ค้นหา">
</form>
<hr>
<form action="choice_service_step_3.php" method="post" name="form1">
<?
$fields=$_GET["fields"];
if($_GET["txtKeyword"] != "")
{
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("fun");
mysql_query("SET NAMES 'tis620'");
// Search By Name or Email
$strSQL = "SELECT * FROM tb_user WHERE (user_status='dc' and $fields LIKE '%".$_GET["txtKeyword"]."%') ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 10; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by user_code ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
<table width="900" border="1" align="center">
<tr bgcolor="#CCCCCC">
<th width="150"> <div align="center">เลือก</div></th>
<th width="150"> <div align="center">รหัสทันตแพทย์</div></th>
<th width="200"> <div align="center"> ชื่อ</div></th>
<th width="200"> <div align="center"> นามสกุล </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><input type="RADIO" name="user_code2" value="<?=$objResult["user_code"];?> "CHECKED> <br></a></center></td>
<td><?=$objResult["user_code"];?></div></td>
<td><center><?=$objResult["user_name"];?></a></center></td>
<td><center><?=$objResult["user_sname"];?></a></center></td>
<?
}
?>
</table>
<br>
พบ <?= $Num_Rows;?> ค้นหา : หน้า <?=$Num_Pages;?> :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]&fields=$_GET[fields]'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]&fields=$_GET[fields]'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]&fields=$_GET[fields]'>Next>></a> ";
}
mysql_close($objConnect);
}
?>
<?
if($_GET["txtKeyword"] == "")
{
mysql_connect('localhost','root','1234'); // connect mysql
mysql_select_db('fun'); // select database
mysql_query("SET NAMES 'tis620'");
if(!isset($start)){
$start = 0;
}
$limit = '10'; // แสดงผลหน้าละกี่หัวข้อ
$Qtotal = mysql_query("select * from tb_user where user_status = 'dc'"); //คิวรี่ คำสั่ง
$total = mysql_num_rows($Qtotal); // หาจำนวน record
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("fun");
$strSQL = "SELECT * FROM tb_user where user_status = 'dc' ORDER BY user_code DESC LIMIT $start,$limit ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$totalp = mysql_num_rows($objQuery); // หาจำนวน record ที่เรียกออกมา
?>
<table width="900" border="1" align="center">
<tr bgcolor="#CCCCCC">
<form action="choice_service_step_3.php" method="post" name="form1">
<th width="150"> <div align="center">เลือก</div></th>
<th width="150"> <div align="center">รหัสทันตแพทย์</div></th>
<th width="200"> <div align="center"> ชื่อ</div></th>
<th width="200"> <div align="center"> นามสกุล </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><input type="RADIO" name="user_code2" value="<?=$objResult["user_code"];?> "CHECKED> <br></a></center></td>
<td><?=$objResult["user_code"];?></div></td>
<td><center><?=$objResult["user_name"];?></a></center></td>
<td><center><?=$objResult["user_sname"];?></a></center></td>
<?
}
/* ตัวแบ่งหน้า */
$page = ceil($total/$limit); // เอา record ทั้งหมด หารด้วย จำนวนที่จะแสดงของแต่ละหน้า
/* เอาผลหาร มาวน เป็นตัวเลข เรียงกัน เช่น สมมุติว่าหารได้ 3 เอามาวลก็จะได้ 1 2 3 */
for($i=1;$i<=$page;$i++){
if($_GET['page']==$i){ //ถ้าตัวแปล page ตรง กับ เลขที่วนได้
echo "[<a href='?start=".$limit*($i-1)."&page=$i'><B>$i</B></A>]"; //ลิ้งค์ แบ่งหน้า เงื่อนไขที่ 1
}else{
echo "[<a href='?start=".$limit*($i-1)."&page=$i'>$i</A>]"; //ลิ้งค์ แบ่งหน้า เงื่อนไขที่ 2
}
}
?>
<?
?>
</table>
<?
}
?>
<?// ส่งข้อมูล เก็บค่า user_code_pt_1=รหัสผู้ป่วย user_name_pt_1=ชื่อผู้ป่วย user_sname_pt_1=นามสกุลผู้ป่วย ไปอีกหน้า?>
<input type="hidden" name="pt_code" value="<?php echo $pt_code; ?>">
<input type="hidden" name="pt_name" value="<?php echo $pt_name; ?>">
<input type="hidden" name="pt_sname" value="<?php echo $pt_sname; ?>">
<?// ส่งข้อมูล เก็บค่า jb_day jb_code ไปอีกหน้า?>
<input type="hidden" name="job_day" value="<?php echo $job_day; ?>">
<input type="hidden" name="job_code" value="<?php echo $job_code; ?>">
<input name="btnSubmit" type="submit" value="Submit">
</body>
</html>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2010-02-22 00:13:36 |
By :
Ninezy |
View :
1911 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วค่ะ ขอบคุณมากค่ะ ใช้ session เก็บค่ะ
มาแปีปเดียวได้เลย ไอเรานั่งทำแทบตายฮ่าๆ
ขอบคุณค่ะ 
|
 |
 |
 |
 |
Date :
2010-02-22 01:38:19 |
By :
Ninezy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|