|
|
|
ช่วยดูโค้ดหน่อยคับ ใน1ฟอร์ม มี 3ปุ่มsubmit จะเช็คว่ากดปุ่มไหนเพื่อส่งไปทำงานเพจต่อไปอะคับ |
|
|
|
|
|
|
|
คือตรงตัวสีแดงอะคับ อยากให้เช็คปุ่มที่กดอะคับว่าเปน 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
|
|
|
|
|
|
Date :
2012-01-06 14:19:27 |
By :
peebowl |
View :
1017 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เช็คจาก name ของชื่อปุ่ม ได้ป่าว (ลองดูๆ)
|
|
|
|
|
Date :
2012-01-06 14:57:05 |
By :
iieszz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|