→ starjou:html & php code 沒分開06/19 20:47
所謂的「分開」是這個意思
※ 引述《bitchdog (上吧傑尼龜)》之銘言:
: <html>
: <head> <title></title> </head>
: <body>
: <form action="Ch9-3-2.php" method="post">
: <?
: $school=$_POST["school"];
: switch ($school) {
: case "teacher":
?>
: 學號:<input type="t1" name="User" size="20"><br> <br>
: 姓名 :<input type="t2" name="Pass" size="20"><br> <br>
: 資料庫 :<input type="t3" name="a" size="20"><br> <br>
: 系統分析:<input type="t4" name="b" size="20"><br> <br>
: LINUX :<input type="t5" name="c" size="20"><br> <br>
: PHP : <input type="t6" name="d" size="20"><br><br>
: <input type ="submit" value="老師登記">
<?
: break;
...
這種寫法不錯,但也可以用另外一種方法:
這種寫法稱為「Here document」,請參考 http://tw.php.net/echo
: <html>
: <head> <title></title> </head>
: <body>
: <form action="Ch9-3-2.php" method="post">
: <?
: $school=$_POST["school"];
: switch ($school) {
: case "teacher":
echo <<<END
: 學號:<input type="t1" name="User" size="20"><br> <br>
: 姓名 :<input type="t2" name="Pass" size="20"><br> <br>
: 資料庫 :<input type="t3" name="a" size="20"><br> <br>
: 系統分析:<input type="t4" name="b" size="20"><br> <br>
: LINUX :<input type="t5" name="c" size="20"><br> <br>
: PHP : <input type="t6" name="d" size="20"><br><br>
: <input type ="submit" value="老師登記">
END;
: break;
...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.30.84
※ 編輯: ybite 來自: 140.112.30.84 (06/19 21:27)
推 bitchdog:有出來,可是兩個都跑出來,會是我前一張也寫錯的關係嗎 06/19 21:36