我已经掌握了这个PHP脚本,并使用它来从上一页的表单加载信息到我当前页面上的表单:
<?php
$addy = $_POST["addy"];
$imgchan = $_POST["imgchan"];
$textcol = $_POST["textcol"];
$texfont = $_POST["texfont"];
$motifsel = $_POST["motifsel"];
$motifcol = $_POST["motifcol"];
$postad = $_POST["postad"];
$emailad= $_POST["emailad"];
$custnme1= $_POST["custnme1"];
$amnt= $_POST["amnt"];
$waxs= $_POST["waxy"];
$adhel= $_POST["adhesy"];
$mult = $_POST["mult"];
$waxmul= $waxs * 1.50;
$adhemul= $adhel * 1.20;
$finalfig= $waxmul + $adhemul + $mult;
?>
我使用&#34; php echo htmlspecialchars($ finalfig)&#34;传递它们。作为形式中的值,可以看到它将它们放在形式上
当我单击表单上的确认时,它会显示第一个表单的未定义索引,即使我没有将该表单传递到下一页。实际上PHP脚本已经达到了它的目的,我不明白它为什么再次对它进行裁判。
帮助!
以下是指向整页所需的链接
https://www.dropbox.com/s/nvtgumysypdn2k9/FinalOrder.php?dl=0
<div style = "position: absolute; left: 180px; top: 730px;" >
<form action="testing.php" method="post">
<input type="text" name="mult" id="mult" value="<?php echo htmlspecialchars($mult); ?>" maxlength="62">
<input type="text" name="addy" id="addy" value="<?php echo htmlspecialchars($addy); ?>" maxlength="62">
<input type="text" name="imgchan" id="imgchan" value="<?php echo htmlspecialchars($imgchan); ?>" maxlength="62">
<input type="text" name="textcol" id="textcol" value="<?php echo htmlspecialchars($textcol); ?>" maxlength="62">
<input type="text" name="texfont" id="texfont" value="<?php echo htmlspecialchars($texfont); ?>" maxlength="62">
<input type="text" name="motifsel" id="motifsel" value="<?php echo htmlspecialchars($motifsel); ?>" maxlength="62">
<input type="text" name="motifcol" id="motifcol" value="<?php echo htmlspecialchars($motifcol); ?>" maxlength="62">
<input type="text" name="postad" id="postad" value="<?php echo htmlspecialchars($postad); ?>" maxlength="62">
<input type="text" name="emailad" id="emailad" value="<?php echo htmlspecialchars($emailad); ?>" maxlength="62">
<input type="text" name="custnme1" id="custnme1" value="<?php echo htmlspecialchars($custnme1); ?>" maxlength="62">
<input type="text" name="amnt" id="amnt" value="<?php echo htmlspecialchars($amnt); ?>" maxlength="62">
<input type="text" name="waxy" id="waxy" value="<?php echo htmlspecialchars($waxs); ?>" maxlength="62">
<input type="text" name="adhemul" id="adhemul" value="<?php echo htmlspecialchars($adhemul); ?>" maxlength="62">
<input type="text" name="finalfig" id="finalfig" value="<?php echo htmlspecialchars($finalfig); ?>" maxlength="62">
<div><textarea name="giftmess"cols="60" rows="8"></textarea></div>
<input type="submit" value="Confirm Your Order.">
我提交的php!
<?php
$filename='DC_'.date('d-m-Y'). ' ' . date("h.i.sa");
$txt = "'";
fwrite($myfile, $txt);
$addy = $_POST["addy1"];
$txt = $addy;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = ", ";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$textcol = $_POST["textcol1"];
$txt = $textcol;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = ", ";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$texfont = $_POST["texfont1"];
$txt = $texfont;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = ", ";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$motifsel = $_POST["motifsel1"];
$txt = $motifsel;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = ", ";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$motifcol = $_POST["motifcol1"];
$txt = $motifcol;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$imgchan = $_POST["imgchan1"];
$txt = $imgchan;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$postad = $_POST["postad1"];
$txt = $postad;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$custnme1 = $_POST["custnme11"];
$txt = $custnme1;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$amnt = $_POST["amnt1"];
$txt = $amnt;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$emailad = $_POST["emailad1"];
$txt = $emailad;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$waxy= $_POST["waxy1"];
$txt = $waxy;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$adhemul= $_POST["adhemul1"];
$txt = $adhemul;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$finalfig= $_POST["finalfig1"];
$txt = $finalfig;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$giftmess= $_POST["giftmess1"];
$txt = $giftmess;
fwrite($myfile, $txt);
$txt = "'";
fwrite($myfile, $txt);
$txt = ", ";
fwrite($myfile, $txt);
fclose($myfile);
?>
Thank you for your submission!
答案 0 :(得分:0)
注意错误不是致命的,也不是关键的错误,但会告诉您潜在的隐藏错误并鼓励更安全的编码(这意味着在这种情况下更多代码)。
您可以调整PHP的error_reporting级别来解除它们。
很可能问题出在最后一节。如果您正在调用htmlspecialchars($ blank_variable)[并且您],您肯定会收到此错误消息。
您可能希望在表单上方执行此操作:
if (isset($mult)) $mult = htmlspecialchars($mult); //do this for all variables
?>
<div style = "position: absolute; left: 180px; top: 730px;" >
<form action="testing.php" method="post">
<input type="text" name="mult" id="mult" value="<?php echo $mult; ?>" maxlength="62">
答案 1 :(得分:0)
您的输入名称与$ _POST数组索引不匹配。例如,您使用
name=“addy”
在FinalOrder.php中,但是
$addy = $_POST[“addy1”];
在testing.php中。它们应该是“addy”或“addy1”。
答案 2 :(得分:0)
答案绝对荒谬!这是我提交的表格上面的一个偏离,这让人感到困惑。
非常感谢您的帮助,我从大家那里获得了一些有用的信息!