|
|
|
ช่วยดูโค๊ตการคำนวณอายุให้หน่อยค่ะ มันผิดตรงไหนแก้ไม่ถูกแล้ว มีรูปประกอบค่ะ |
|
|
|
|
|
|
|
อันนี้คือ page1
Code
<html>
<body>
<form method ="post" action ="page2.php">
<title>Welcome To BBA INTERNATIONAL COMPUTER INFORMAITON SYSTEM PROGRAM</title>
<b><font size="5"> NAME : </font></b> <input type="text" name="n1">
<b><font size="5"> LASTNAME : </font></b> <INPUT TYPE="text" name="l2"> <br><br><br>
<font size="5"> BIRTHDAY : </font> <select name="date">
<?
$eee = array ('1', '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '10' , '11' , '12' , '13' ,'14' , '15' , '16' , '17' , '18' , '19' , '20' , '21' , '22' , '23' , '24' , '25' , '26' , '27' , '28' , '29' , '30' , '31');
foreach ($eee as $mm => $vv) {
echo "<option value= $mm > $vv </option>";
}
?>
</select>
<font size="5"> MONTH : <select name="month">
<?
$xxx = array ('JANUARY', 'FEBRUARY' , 'MARCH' , 'APRIL' , 'MAY' , 'JUNE' , 'JULY' , 'AUGUST' , 'SEPTEMBER' , 'OCTOBER' , 'NOVEMBER' , 'DECEMBER');
foreach ($xxx as $nn => $aa) {
echo "<option value= $nn > $aa </option>";
}
?>
</select>
<font size="5"> YEAR : </font>
<select name="y1">
<?
$zzz = array ('1980', '1981' , '1982' , '1983' , '1984' , '1985' , '1986' , '1987' , '1988' , '1989' , '1990' , '1991' ,'1992' , '1993', '1994' , '1995' , '1996' , '1997' ,'1998','1999','2000' ,'2001' ,'2002' , '2003' , '2004' ,'2005','2006','2007','2008' , '2009' , '2010');
foreach ($zzz as $bb => $tt) {
echo "<option value= $bb > $tt </option>";
}
?>
</select>
<br><br><br><font size="5"> REMARK </font></br>
<br><TEXTAREA name="r1" ROWS="5" COLS="80"></TEXTAREA></br></br>
<INPUT TYPE="submit" value="submit">
</form>
</body>
</html>
จะได้รูปแบบนี้ค่ะ
พอกด Sumit ไปหน้าสองคำนวณอายุ มันไม่ได้อ่าค่ะมันได้เป็นแบบนี้
Code
<html>
<body>
<p><?
if (empty ($_REQUEST['n1']))
echo 'PLEASE INSERT NAME'."<br>"."<p>";
else
{echo 'Welcome <br><br>'. ' '.stripslashes($_REQUEST['n1'])."<br>"."<p>"."<br>";
echo 'Age'."<br>"."<p>";
$now=2010;
$Age=$now-$_REQUEST['y1'];
echo $Age.' '.'years'."<br>"."<p>"."<br>";
echo 'Remark'."<i>"."<br>"."<p>";
echo stripslashes($_REQUEST['r1']);}
?></p>
</body>
</html>
รบกวนพี่ๆช่วยดูโค๊ตให้หน่อยนะค่ะ มือใหม่หัดเรียนรู้ค่ะ ขอบคุณค่ะ ติดตรง คำนวณอายุอ่าค่ะ มันต้องออกมาเป็น 20 ปี 15 ปี อะไรประมาณนี้อ้าค่ะ
Tag : PHP
|
|
|
|
|
|
Date :
2010-12-07 14:16:59 |
By :
IC_ORACLE |
View :
1010 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<html>
<body>
<form name="frm1" method ="post" action ="" enctype="multipart/form-data">
<title>Welcome To BBA INTERNATIONAL COMPUTER INFORMAITON SYSTEM PROGRAM</title>
<b><font size="5"> NAME : </font></b> <input type="text" name="name">
<b><font size="5"> LASTNAME : </font></b> <INPUT TYPE="text" name="lname"> <br><br><br>
<font size="5"> BIRTHDAY : </font>
<select name="selectdate">
<?php
/*$eee = array ('1', '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '10' , '11' , '12' , '13' ,'14' , '15' , '16' , '17' , '18' , '19' , '20' , '21' , '22' , '23' , '24' , '25' , '26' , '27' , '28' , '29' , '30' , '31');
foreach ($eee as $mm) {
echo "<option value= $mm > $mm </option>";
}
*/
for($d=1;$d<32;$d++){
echo "<option value= $d > $d </option>";
}
?>
</select>
<font size="5"> MONTH : <select name="month">
<?php
$xxx = array ('JANUARY', 'FEBRUARY' , 'MARCH' , 'APRIL' , 'MAY' , 'JUNE' , 'JULY' , 'AUGUST' , 'SEPTEMBER' , 'OCTOBER' , 'NOVEMBER' , 'DECEMBER');
foreach ($xxx as $nn => $aa) {
echo "<option value= ".($nn+1)." > $aa </option>";
}
?>
</select>
<font size="5"> YEAR : </font>
<select name="y1">
<?php
/*$zzz = array ('1980', '1981' , '1982' , '1983' , '1984' , '1985' , '1986' , '1987' , '1988' , '1989' , '1990' , '1991' ,'1992' , '1993', '1994' , '1995' , '1996' , '1997' ,'1998','1999','2000' ,'2001' ,'2002' , '2003' , '2004' ,'2005','2006','2007','2008' , '2009' , '2010');
foreach ($zzz as $bb) {
echo "<option value= $bb > $bb </option>";
}
*/
for($y=1980;$y<2011;$y++){
echo "<option value= $y > $y </option>";
}
?>
</select>
<br><br><br><font size="5"> REMARK </font></br>
<br><TEXTAREA name="r1" ROWS="5" COLS="80"></TEXTAREA></br></br>
<INPUT TYPE="submit" value="submit">
</form>
</body>
</html>
<?php
echo $_POST['name'];
echo '<br/>';
echo $_POST['lname'];
echo '<br/>';
echo $_POST['selectdate'];
echo '<br/>';
echo $_POST['month'];
echo '<br/>';
echo $_POST['y1'];
echo '<br/>';
echo $_POST['r1'];
echo '<br/>';
$age = date('Y') - $_POST['y1'];
echo "Age = ".$age." years";
?>
|
|
|
|
|
Date :
2010-12-07 14:50:42 |
By :
t-monroe |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากๆๆคะ่
|
|
|
|
|
Date :
2010-12-07 14:59:24 |
By :
IC_ORACLE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|