开发者

Unable to access _POST values PHP

Find below my form and the acti开发者_开发问答on page it submits to. The _POST array is empty. Not sure how. Please help.

index.php

<form method="post" action="track-them.php">
<input type="text" width="255" id="txt" />
<textarea id="ta" type="text" cols="25" rows="4"></textarea>
<input type="submit" id="check-button" value="Ok" />
</form>

track-them.php

<?php
include_once('../simple_html_dom.php');
print_r($_POST);
?>

Both fields txt & ta have values but the output I see when I click submit is:

Array ( )


Add name attribute to your form elements:

<form method="post" action="track-them.php">
<input type="txt" width="255" id="myurl" name="myurl" />
<textarea id="ta" name="ta" type="text" cols="25" rows="4"></textarea>
<input type="submit" id="check-button" value="Ok" />
</form>


Give your inputs a name. The browser passes the name attribute not the id.


If you put the print_r($_POST) above the inclution what is the result ?


Please add name attribute for each from element

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜