我想打印使用数组的表单字段的值。我在file1.php中有两个字段,名称和电子邮件,我通过post传递给file2.php并将其存储在数组中。如何在PHP的表单字段中打印数组值?
<?php
$name = $_post['name']
$email = $_post['email];
function personal($name, $email) {
$return = array($name, $email);
print_r($return); //Output(Array ([0] => alisha [1] => [email protected])
echo implode('<br>', $return); //Output alisha [email protected]
?>
如何打印这些值,ALISHA和[email protected],在file1.php当用户使用提交按钮转到上一页而不使用会话和饼干?
<input type=text name=name value="**print alisha here array[0]**">
<input type=text name=email value="**print [email protected] here array[1]**">
value =“<?php echo $ return [0]?>”,但我不明白为什么你应该使用数组,当你有变量allready($ name,$ email))? – bksi 2014-10-28 23:18:47
@bksi - 也将它们作为$ _POST ['email']&$ _POST ['name']。为什么他们经历了两次相同值的变化? – ggdx 2014-10-28 23:25:46
@bksi -its,因为我使用隐藏变量和函数将此变量传递给多个页面,并最终将所有值存储在数组中。没有数组我能够解决这个问题。 – user3385022 2014-10-28 23:40:56