第一个片段从两个文本字段中获取数据并发送到action script.php
. 问题是if
即使我没有在文本字段中输入任何内容,这两个语句都评估为 true。这是为什么 ?
try.php
<form method='get' action='./action_script.php'>
<input type="text" id="text_first" name="text_first" /> <br />
<input type="text" id="text_second" name="text_second"/> <br />
<input type="submit" id="submit" />
</form>
action_script.php
<?php
if(isset($_GET['text_first'])) {
echo "Data from the first text field : {$_GET['text_first']} <br>";
}
if(isset($_GET['text_second'])) {
echo "Data from the second text field : {$_GET['text_second']} <br>";
}
echo "After the if statement <br />";