我有一个页面,其中显示每个人的简要记录,并且如果有人想要编辑记录,那么每个人的详细信息链接到另一个页面,该页面上有选项但是使另一个变量无法工作。
<form action="std_edit.php?edit_id=<?php echo $std_id; ?>">
<input class="std_edit" type="submit" name="edit" value = "Edit">
</form>
我回应了之前的get变量并且它的打印很好。我怎样才能让它适合我?
答案 0 :(得分:0)
首先,您可以“获取”变量,只要您可以在URL中看到它。例如:exmaple.com?std_id=Boo
在代码中你做了一些事情:
$std_id = $_GET['std_id']; //$std_id will be Boo
<form action="std_edit.php?edit_id=<?php echo $std_id; ?>">
<input class="std_edit" type="submit" name="edit" value = "Edit">
</form>
如果你想要一些变量,它必须在URL中。 以上面的示例为例,您无法执行以下操作:
$std_id = $_GET['id'];
原因,网址中没有ID。
答案 1 :(得分:0)
问题是,当您提交表单时,<form action="std_edit.php">
<input type="hidden" name="edit_id" value="<?php echo $std_id; ?>" />
<input class="std_edit" type="submit" name="edit" value = "Edit" />
</form>
属性中设置的任何GET变量都将丢失。这是因为在提交时,GET请求是完全重建的。您所要做的就是:
MaterialBetterSpinner MBS = (MaterialBetterSpinner) findViewById(R.id.Spinner);
MBS.addTextChangedListener(new myTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
Log.e("Text",MBS.getText().toString());
}
});
这将使它再次发挥作用。