我想提交兩個表單字段值到一個PHP函數,在同一頁上。 該功能完美地手動填充這兩個值。簡單的表單提交到PHP函數失敗
<?PHP // Works as expected
echo "<br />"."<br />"."Write text file value: ".sav_newval_of(e, 45);
?>
在窗體上,我必須缺少一些東西,或者我有一個語法錯誤。網頁無法顯示。我發現下面的例子在這裏:A 1 Year old Stackoverflow post
<?php
if(isset($_GET['submit'])) {
$val1 = htmlentities($_GET['val1']);
$val2 = htmlentities($_GET['val2']);
$result = sav_newval_of($val1, $val2);
}
?>
<?php if(isset($result)) echo $result; //print the result of the form ?>
<form action="" method="get">
Input position a-s:
<input type="text" name="val1" id="val1"></input>
<br></br>
Input quantity value:
<input type="text" name="val2" id="val2"></input>
<br></br>
<input type="submit" value="send"></input>
</form>
難道是我的窗體上放置代碼? 任何建議表示讚賞。
而語法錯誤是? – Rizier123 2014-12-06 20:58:16