|
 |
|
PHP สอบถามปัญหาในการส่งค่า Textbox ไปยังอีกหน้าหนึ่งครับ |
|
 |
|
|
 |
 |
|
ตอนนี้ผมต้องการจะส่งค่าจาก textbox จากหน้า ที่ 1.php
ไปยังหน้า 2.php
เพื่อที่จะนำค่าดังกล่าวไปใช้งานต่อ
โดยปุ่ม ผมใช้เป็น none ละส่งค่าไปยังหน้า 2.phpแบบมีค่าพวงไปด้วยวครับ
แนะนำหน่อยครับว่าต้องปรับแก้ยังไง
หน้า 1.php
Code (PHP)
<form id="form1" name="form1" method="post" action="approve.php">
<div align="center">
<p class="style21">อนุมัติยืม </p>
<p class="style21"> </p>
<table width="50%" border="0" align="center">
<tr>
<td width="26%" class="style20">รหัสประจำตัว</td>
<td width="74%" class="style20"><?php echo $row_Recordset1['borrow_member_code']; ?></td>
</tr>
<tr>
<td class="style20">ชื่อหนังสือ</td>
<td class="style20"><?php echo $row_Recordset1['book_name']; ?></td>
</tr>
<tr>
<td class="style20">เลขISBN</td>
<td><label>
<span class="style20"><?php echo $row_Recordset1['borrow_isbn']; ?></span>
<select name="select" id="select">
<option value="0" <?php if (!(strcmp(0, "book_number"))) {echo "selected=\"selected\"";} ?>>=กรุณาเลือก=</option>
<?php
do {
?>
<option value="<?php echo $row_Recordset2['book_number_number']?>"<?php if (!(strcmp($row_Recordset2['book_number_number'], "book_number"))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset2['book_number_number']?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</select>
<br />
</label></td>
</tr>
<tr>
<td><span class="style20">เลขทะเบียน</span></td>
<td><input type="text" name="textfield" id="textfield" value="<? echo $_GET['textfield']; ?>" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<label>
<? $a = 'textfield.text' ?>
<input name="Button" type="button" id="button" onclick="MM_goToURL('parent','approve.php?borrow_id=<?php echo $row_Recordset1['borrow_id']; ?>&book_isbn=<?php echo $row_Recordset1['borrow_isbn']; ?>&book_number=<? echo "$a" ?>&borrow_date=<?php echo $row_Recordset1['borrow_date']; ?>&member_code=<?php echo $row_Recordset1['borrow_member_code']; ?>&new_status=<?php echo "2" ?>');return document.MM_returnValue" value="ตกลง" />
</label>
<label>
<input name="button2" type="button" id="button2" onclick="MM_goToURL('parent','authority_borrow_approve.php');return document.MM_returnValue" value="ยกเลิก" />
</label>
</div></td>
</tr>
</table>
<p>
<input name="borrow_id" type="hidden" id="borrow_id" value="<?php echo $row_Recordset1['borrow_id']; ?>" />
<input name="new_status" type="hidden" id="new_status" value="2" />
</p>
<p class="style21"> </p>
</div>
</form>
หน้า 2.php
Code (PHP)
<?php {session_start();} ?>
<?php require_once('Connections/library.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" />
</head>
<body>
<p>1 <? echo $_GET['member_code'] ?></p>
<p>2 <? echo $_GET['book_isbn'] ?></p>
<p>3 <? echo $_GET['new_status'] ?></p>
<p>4 <? echo date("j / F / Y") ?></p>
<p>5 <? echo $_GET['book_number'] ?></p>
<p>6 <? echo $_GET['borrow_id'] ?></p>
<p>7 <? echo $_GET['borrow_date'] ?></p>
<p>8 <? echo $_POST['textfield'] ?></p>
<p>9<? echo $_GET['textfield']; ?></p>
</body>
</html>
แต่ค่าที่ผมส่งไปของTEXTBOX มันไม่แสดงผลครับ
รบกวนหน่อยครับพี่ๆ
Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax, jQuery

|
|
 |
 |
 |
 |
Date :
2012-06-04 02:13:24 |
By :
numprick |
View :
2546 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือตอนนี้ผมใช้การส่งค่า โดยใช้ Button
และฝาก ค่าไปยัง อีกหน้าครับ
Code (PHP)
<input name="Button" type="button" id="button" onclick="MM_goToURL('parent','approve.php?borrow_id=<?php echo $row_Recordset1['borrow_id']; ?>&book_isbn=<?php echo $row_Recordset1['borrow_isbn']; ?>&book_number=<? echo "$a" ?>&borrow_date=<?php echo $row_Recordset1['borrow_date']; ?>&member_code=<?php echo $row_Recordset1['borrow_member_code']; ?>&new_status=<?php echo "2" ?>');return document.MM_returnValue" value="ตกลง" />
แต่ถ้าในการนี้ผมจะต้องการ ฝากค่าที่อยู๋ใน textbox ไป ด้วยเพิ่มอีกค่า1 จะทำอย่างไรได้ครับ
คือ
ผมลองใช่
<? echo $_POST['textfield'] ?>
ตามหน้า PHP Post ($_POST,$HTTP_POST_VARS) ไปแล้วครับ แต่ค่าไม่ขึ้นในหน้าที่ 2 ครับ
|
 |
 |
 |
 |
Date :
2012-06-04 11:50:36 |
By :
numprick |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
post รับไม่ได้ลองรับแบบ get แล้วหรือยังครับ
ว่าแต่ทำไมต้องใช้ button ในการส่งค่าครับ
|
 |
 |
 |
 |
Date :
2012-06-04 14:41:54 |
By :
บังเอิญผ่านมาเห็น |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|