Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ช่วยดูโค้ดหน่อยคับ ใน1ฟอร์ม มี 3ปุ่มsubmit จะเช็คว่ากดปุ่มไหนเพื่อส่งไปทำงานเพจต่อไปอะคับ



 

ช่วยดูโค้ดหน่อยคับ ใน1ฟอร์ม มี 3ปุ่มsubmit จะเช็คว่ากดปุ่มไหนเพื่อส่งไปทำงานเพจต่อไปอะคับ

 



Topic : 071411

Guest




คือตรงตัวสีแดงอะคับ อยากให้เช็คปุ่มที่กดอะคับว่าเปน select ,edit หรือ delete เพื่อส่งไปเพจทำงานตามคำสั่งคับ

Code
<!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 News Position</title>
<?php
include('config.inc.php');
?>
</head>
<body>
<div style=" position:absolute; float:left; margin-left:450px;"> <img src="list.jpg" /> </div>
<?php

$sql="SELECT * FROM mehotnew";
$dbquery_sub = mysql_db_query($dbname,$sql) or die ("connection error!!!");

?>
<form id="form1" name="form1" method="post" action="" style="font-family:Tahoma, Geneva, sans-serif;">
<div style="float:left; text-align:center;">
<table border="0" align="center" cellpadding="0">
<tr>
<td width="110" align="left">NewsBox
<select name="numBox" size="1" id="numBox">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select></td>
<?php
$numBox = $_POST[numBox];
?>
<td align="left" width="238"><label>
<select name="UserListBox" size="1" id="UserListBox" style="width:220px;" onchange="frmMain.">
<option>--select--</option>
<?
while($result_sub=mysql_fetch_array($dbquery_sub))
{
$strShow = $result_sub["news"];
$idShow = $result_sub["id"];
$strShow = $idShow." ".mb_substr($strShow,0,45,'utf-8');
//$strShow += mb_substr($strShow,0,45,'utf-8');
?>
<option value="<?=$strShow;?>">
<?=$strShow;?>
...</option>
<?
}
?>
</select>
</label></td>
<td width="30"><input type="submit" name="EdittButton" id="EdittButton" value="Preview" /></td>
</tr>
<tr>
<td colspan="3" style="font-size:10px; color:#F00; text-align:left;">* เลือกหมายเลข NewsBox ที่ต้องการแก้ไขและกดปุ่ม Preview<br /></td>
</tr>
<tr>
<td colspan="3" style="font-size:10px; color:#000; text-align:left;">----------------------------------------------------------------------------------------------------</td>
</tr>
</table>
</div>
<?

$show = $_POST[UserListBox];
$idselect = mb_substr($show,0,4,'utf-8');
//echo $idselect;
?>
</form>

<?
if($_POST["submit"]=="select")
{
print "You choose Insert ".$show;
$msg = "Account create successed";
echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>";
echo "<meta http-equiv='refresh' content='0;URL=savetopnews.php' />";
}
if($_POST["submit"]=="edit")
{
//print "You choose Update ".$_POST["data"];
}
if($_POST["submit"]=="delete")
{
//print "You choose Delete ".$_POST["data"];
}
if($_POST["submit"]=="")
{
?>
<form name="form1" action="<?=$_SERVER["PHP_SELF"]?>" method="post">
<div style="width:300px;">
<?php
$sql_select="SELECT * FROM mehotnew WHERE id = '$idselect'";
$dbquery = mysql_db_query($dbname,$sql_select) or die ("connection error!!!");
while($result=mysql_fetch_array($dbquery))
{
$showAll = $result['news'];
}
mysql_close($con);

?>
<textarea name="topnews" cols="45" rows="5" id="topnews" style="width:400px;"><?php echo $showAll; ?></textarea>
<br />
<input type="hidden" name="idselect" value="<?=$idselect; ?>" />
<input type="hidden" name="topid" value="<?=$numBox;?>" />
<input type="submit" name="select" value="select" />
<input type="submit" name="edit" value="edit" />
<input type="submit" name="delete" value="delete" />
</div>
</form>
<?php
}
?>

</body>
</html>




Tag : PHP, MySQL, CakePHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-01-06 14:19:27 By : peebowl View : 990 Reply : 4
 

 

No. 1



โพสกระทู้ ( 135 )
บทความ ( 0 )



สถานะออฟไลน์



ลองทำโค้ดให้เป็นแบบนี้นะครับ จะได้อ่านได้ง่ายครับ
ตัวอย่าง https://www.thaicreate.com/php/forum/071407.html








ประวัติการแก้ไข
2012-01-06 14:37:24
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-06 14:35:44 By : ขนมหม้อแกง
 


 

No. 2

Guest


Code (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>Edit News Position</title>
<?php
include('config.inc.php');
?>
</head>
<body>
<div style=" position:absolute; float:left; margin-left:450px;"> <img src="list.jpg" /> </div>
<?php

$sql="SELECT * FROM mehotnew";
$dbquery_sub = mysql_db_query($dbname,$sql) or die ("connection error!!!");

?>
<form id="form1" name="form1" method="post" action="" style="font-family:Tahoma, Geneva, sans-serif;">
<div style="float:left; text-align:center;">
<table border="0" align="center" cellpadding="0">
<tr>
<td width="110" align="left">NewsBox
<select name="numBox" size="1" id="numBox">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select></td>
<?php
$numBox = $_POST[numBox];
?>
<td align="left" width="238"><label>
<select name="UserListBox" size="1" id="UserListBox" style="width:220px;" onchange="frmMain.">
<option>--select--</option>
<? 
while($result_sub=mysql_fetch_array($dbquery_sub))
{
$strShow = $result_sub["news"];
$idShow = $result_sub["id"];
$strShow = $idShow." ".mb_substr($strShow,0,45,'utf-8');
//$strShow += mb_substr($strShow,0,45,'utf-8'); 
?>
<option value="<?=$strShow;?>">
<?=$strShow;?>
...</option>
<?
}	
?>
</select>
</label></td>
<td width="30"><input type="submit" name="EdittButton" id="EdittButton" value="Preview" /></td>
</tr>
<tr>
<td colspan="3" style="font-size:10px; color:#F00; text-align:left;">* เลือกหมายเลข NewsBox ที่ต้องการแก้ไขและกดปุ่ม Preview<br /></td>
</tr>
<tr>
<td colspan="3" style="font-size:10px; color:#000; text-align:left;">----------------------------------------------------------------------------------------------------</td>
</tr>
</table>
</div>
<?

$show = $_POST[UserListBox];
$idselect = mb_substr($show,0,4,'utf-8');
//echo $idselect;
?>
</form>

<? 
if($_POST["submit"]=="select") 
{ 
print "You choose Insert ".$show; 
$msg = "Account create successed";
echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>"; 
echo "<meta http-equiv='refresh' content='0;URL=savetopnews.php' />";
} 
if($_POST["submit"]=="edit") 
{ 
//print "You choose Update ".$_POST["data"]; 
} 
if($_POST["submit"]=="delete") 
{ 
//print "You choose Delete ".$_POST["data"]; 
} 
if($_POST["submit"]=="") 
{ 
?>
<form name="form1" action="<?=$_SERVER["PHP_SELF"]?>" method="post">
<div style="width:300px;">
<?php
$sql_select="SELECT * FROM mehotnew WHERE id = '$idselect'";
$dbquery = mysql_db_query($dbname,$sql_select) or die ("connection error!!!");
while($result=mysql_fetch_array($dbquery))
{
$showAll = $result['news'];
}
mysql_close($con);

?>
<textarea name="topnews" cols="45" rows="5" id="topnews" style="width:400px;"><?php echo $showAll; ?></textarea>
<br />
<input type="hidden" name="idselect" value="<?=$idselect; ?>" />
<input type="hidden" name="topid" value="<?=$numBox;?>" />
<input type="submit" name="select" value="select" />
<input type="submit" name="edit" value="edit" />
<input type="submit" name="delete" value="delete" />
</div>
</form>
<?php 
} 
?>
</body>
</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-06 14:50:52 By : peebowl
 

 

No. 3



โพสกระทู้ ( 1,127 )
บทความ ( 2 )



สถานะออฟไลน์


เช็คจาก name ของชื่อปุ่ม ได้ป่าว (ลองดูๆ)
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-06 14:57:05 By : iieszz
 


 

No. 4

Guest


ตอบความคิดเห็นที่ : 3 เขียนโดย : iieszz เมื่อวันที่ 2012-01-06 14:57:05
รายละเอียดของการตอบ ::
อ๊าา ใช่จิงด้วยคับ ขอบคุนคับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-06 18:03:54 By : peebowl
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดูโค้ดหน่อยคับ ใน1ฟอร์ม มี 3ปุ่มsubmit จะเช็คว่ากดปุ่มไหนเพื่อส่งไปทำงานเพจต่อไปอะคับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่