現在、xml titleの値を配列に格納しようとしていますが、これは今度は休日を保存するために使用されます。私はまだエラーメッセージが表示されず、次の情報を収集するためにvar_dumpを使用しています。私に配列に必要なパラメータが格納されていません
array(7) { [0]=> string(21) "{$currentItem->title}" [1]=> string(21)"{$currentItem->title}" [2]=> string(21) "{$currentItem->title}" [3]=> string(21) "{$currentItem->title}" [4]=> string(21) "{$currentItem->title}" [5]=> string(21) "{$currentItem->title}" [6]=> string(21) "{$currentItem->title}" } :S
このアレイ側が動作しているが、それはすべての文字列がそうであるように、チェックボックスの値のパラメータの範囲内に設定された情報を保持していないことを示している(RSSフィードの読み込みに関連するいくつかのチェックボックスのがチェックさ) 21? 21は、saveBoxの値の引用符の間の文字数です。 index.phpの
$index = 1;
foreach ($allHolidays as $currentItem)
{
echo '<tr>';
if (isset($_SESSION['login']))
{
echo '<td valign="top">';
//echo '<input type="hidden" name="guid$index" value="{$currentItem->guid}">';name="saveBox$index[]"
echo '<input type="checkbox" name="saveBox[]" value="{$currentItem->title}">';
echo '</td>';
}
echo '<td>';
echo "<p><a href=\"{$currentItem->link}\">{$currentItem->title}</a><br/>";
echo "{$currentItem->description}<br/>";
echo "{$currentItem->pubDate}<br/></p>";
echo '</td>';
echo '</tr>';
$index++;
}
saveProcess.php
<?php
header("refresh:555; url='index.php'");
session_start();
echo "Thank you for saving a holiday";
echo '<input type="checkbox" name="saveBox[]" value="'.
htmlspecialchars($currentItem->title).'">';
include "top.php";
var_dump($_POST['saveBox']);
try
{
foreach ($_POST['saveBox'] as $savedHoliday)
{
$user = $_SESSION['login'];
$currentSave = $savedHoliday;
$save = "channel/item[title=\"$currentSave\"]";
$holidaysXML = simplexml_load_file('holidays.xml');
$savePath = $holidaysXML->xpath($save);
foreach($savePath as $currentSavePath)
{
echo "<p><a href='{$currentSavePath->link}'>{$currentSavePath->title}</a>"."<br\>".
"{$currentSavePath->description}"."<br\>".
"{$currentSavePath->pubDate}"."<br\></p>";
$insertSave = $db->prepare("INSERT INTO `saved_holidays` (`subscriberID`, `link`, `pubDate`, `title`, `description`)
VALUES ('$user', '$currentSavePath->link', '$currentSavePath->pubDate', '$currentSavePath->title', '$currentSavePath->description')");
$insertSave->execute();
}
}
}
catch(PDOException $e)
{
echo $e->getMessage();
}
私は今あなたの「質問」を3回読んだことがありませんし、そのことをすることはできません... – stUrb
私は正しい情報がチェックボックスによって保持されていることを確認するために配列をチェックしようとしていましたデータベース内に格納します。チェックボックスは正しい情報を保持していますが、私のデータベースにこの情報を保存することはできません。何が間違っていたのでしょうか。 –