重新显示错误的表单数据

时间:2016-01-30 13:00:59

标签: php post curl error-handling

我使用表单来收集数据,编辑它然后使用cURL重新显示带有错误消息的表单。问题是最初输入的输入数据被擦除。进行。

我尝试使用带有包含发布数据的数组的POSTFIELDS选项重新显示数据。但这不起作用。

这是cURL代码。

errors:
$data = array (book => $book, begchap => $begchap, begverse => $begverse, endchap => $endchap, endverse => $endverse);
//foreach($data as $x => $x_value) {
//    echo "Key=" . $x . ", Value=" . $x_value;
//    echo "<br>";
//}
// Get cURL resource
$url="http://www.seekinghimdaily.org/php_snippets/read_any_passage_new.snippet.php/?e1=".$e1."&e2=".$e2."&e3=".$e3."&e4=".$e4."&e5=".$e5."&e6=".$e6;
//Step 1 - initialize cURL session 
$cSession = curl_init(); 
//step2 - set cURL options
curl_setopt($cSession,CURLOPT_URL,$url);
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
//curl_setopt($cSession,CURLOPT_POST,true);
//curl_setopt($cSession,CURLOPT_POSTFIELDS,$data);
curl_setopt($cSession,CURLOPT_HEADER, false);   
//step3 - Execute cURL session
$result=curl_exec($cSession);
if(curl_errno($cSession))
{
    echo 'error:' . curl_error($cSession);
}
//step4 - Close cURL session
//step5
echo $result;
end:
?>

这是我试图用来重新显示键控数据和错误消息的代码行。

<br><span style="margin: 18x 15px 18px 18px;  ">Beginning Verse <input type="text" id="begverse" name="begverse" size="2" maxlength="2" value="<?php echo $_POST['begverse']?>"/></span>'
<?php 
if ($e5=='y')
  {
   echo '<span style="color: red"> Not in book. </span>';
  }
?>

再次感谢您的耐心和帮助。

0 个答案:

没有答案
相关问题