更新解決済みの問題!PHPセッションの問題
コードを調べた後、ひどく神経質問題は、私は
header ('location:referraldone.php?say=blankfields');
}
後}else{}
がありませんでしたでした。
このセッションコードでは本当に失われています。セッションがなぜ機能していないのか分かりません。どこで私は間違えましたか?私は、フィールドに入力されたデータを、次のページに移動しようとしています。コードは以下の通りです:ここでは
<?php
if (!$_POST['cname'] | !$_POST['cphone'] | !$_POST['caddress'] | !$_POST['ccity'] | !$_POST['cstate'] | !$_POST['czip'] | !$_POST['cbirthday']) {
$rname = $_REQUEST['rname'];
$rdate = $_REQUEST['rdate'];
$ragency = $_REQUEST['ragency'];
$rphone = $_REQUEST['rphone'];
$cname = $_REQUEST['cname'];
$cphone = $_REQUEST['cphone'];
$caddress = $_REQUEST['caddress'];
$ccity = $_REQUEST['ccity'];
$cstate = $_REQUEST['cstate'];
$czip = $_REQUEST['czip'];
$cbirthday = $_REQUEST['cbirthday'];
$medmemid = $_REQUEST['medmemid'];
$medclaim = $_REQUEST['medclaim'];
$marital = $_REQUEST['marital'];
$income = $_REQUEST['income'];
$gender = $_REQUEST['gender'];
$race = $_REQUEST['race'];
$caregiver = $_REQUEST['caregiver'];
$relationship = $_REQUEST['relationship'];
$memphone = $_REQUEST['memphone'];
$physician = $_REQUEST['physician'];
$phyphone = $_REQUEST['phyphone'];
session_start();
$_SESSION['rname'] = $rname;
$_SESSION['rdate'] = $rdate;
$_SESSION['ragency'] = $ragency;
$_SESSION['rphone'] = $rphone;
$_SESSION['cname'] = $cname;
$_SESSION['cphone'] = $cphone;
$_SESSION['caddress'] = $caddress;
$_SESSION['ccity'] = $ccity;
$_SESSION['cstate'] = $cstate;
$_SESSION['czip'] = $czip;
$_SESSION['cbirthday'] = $cbirthday;
$_SESSION['medmemid'] = $medmemid;
$_SESSION['medclaim'] = $medclaim;
$_SESSION['marital'] = $marital;
$_SESSION['income'] = $income;
$_SESSION['gender'] = $gender;
$_SESSION['race'] = $race;
$_SESSION['caregiver'] = $caregiver;
$_SESSION['relationship'] = $relationship;
$_SESSION['memphone'] = $memphone;
$_SESSION['physician'] = $physician;
$_SESSION['phyphone'] = $phyphone;
header ('location:referraldone.php?say=blankfields');
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table style="text-align:left; width: 500px; left:45px; position:relative; padding:2px; border:1px solid #1A1A1A">
<tr>
<td colspan="2" style="vertical-align:top; text-align:center; border:1px solid #1A1A1A; background-color:#A52A2A; color:#FFFFFF;">REFERRAL FORM</td>
</tr>
<tr>
<td colspan="2"><center>Choose us as your Home Care Agency!<br />We provide services 24 hours per day, 7 days a week.<br /><br />Please submit form below and your respond time<br />will be 48 hours.<br /><br /><strong>*Bold Fields Required</strong><br /><br /></td>
</tr>
<tr>
<td valign="top">Reffered By:<br /><input name="rname" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Reffered Date:<br /><input name="rdate" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Reffered Agency:<br /><input name="ragency" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Phone:<br /><input name="rphone" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Client Name:</strong><br /><input name="cname" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Phone:</strong><br /><input name="cphone" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Address:</strong><br /><input name="caddress" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* City:</strong><br /><input name="ccity" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* State:</strong><br /><input name="cstate" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Zip Code:</strong><br /><input name="czip" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Birthday:</strong><br /><input name="cbirthday" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Medicaid Member ID:<br /><input name="medmemid" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Medicare Claim:<br /><input name="medclaim" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Marital Status:<br /><input name="marital" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Monthly Income:<br /><input name="income" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Gender:<br /><input name="gender" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Race:<br /><input name="race" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Caregiver Name:<br /><input name="caregiver" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Relationship:<br /><input name="relationship" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Phone:<br /><input name="memphone" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Physician:<br /><input name="physician" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Phone:<br /><input name="phyphone" type="text" style="width:98%" /></td>
</tr>
<tr>
<td valign="top" style="color:#C00000"><br />Please make sure all the <strong>BOLD</strong> fields are completed before submitting form.<br /><br /></td>
</tr>
<tr>
<td align="right"><input type="reset" value="Clear Fields"> <input type="submit" name="send" value="Send" /></td>
</tr>
</table>
</form>
は、セッションデータを取得し、それをフィールドに記入しなければならないエラーページですが、それはしていません:
<?php
$sb = "5";
$say = $_REQUEST['say'];
$rname = $_SESSION['rname'];
$rdate = $_SESSION['rdate'];
$ragency = $_SESSION['ragency'];
$rphone = $_SESSION['rphone'];
$cname = $_SESSION['cname'];
$cphone = $_SESSION['cphone'];
$caddress = $_SESSION['caddress'];
$ccity = $_SESSION['ccity'];
$cstate = $_SESSION['cstate'];
$czip = $_SESSION['czip'];
$cbirthday = $_SESSION['cbirthday'];
$medmemid = $_SESSION['medmemid'];
$medclaim = $_SESSION['medclaim'];
$marital = $_SESSION['marital'];
$income = $_SESSION['income'];
$gender = $_SESSION['gender'];
$race = $_SESSION['race'];
$caregiver = $_SESSION['caregiver'];
$relationship = $_SESSION['relationship'];
$memphone = $_SESSION['memphone'];
$physician = $_SESSION['physician'];
$phyphone = $_SESSION['phyphone'];
if(isset($say)){
switch ($say){
case "formsent":
$return = "Referral Form Sent. Your respond time will be 48 hours.";
break;
case "blankfields":
$return = "All <strong>Bold</strong> Fields Required";
break;
default:
break;
}
}
if (isset($_POST['send'])) {
if (!$_POST['cname'] | !$_POST['cphone'] | !$_POST['caddress'] | !$_POST['ccity'] | !$_POST['cstate'] | !$_POST['czip'] | !$_POST['cbirthday']) {
$rname = $_REQUEST['rname'];
$rdate = $_REQUEST['rdate'];
$ragency = $_REQUEST['ragency'];
$rphone = $_REQUEST['rphone'];
$cname = $_REQUEST['cname'];
$cphone = $_REQUEST['cphone'];
$caddress = $_REQUEST['caddress'];
$ccity = $_REQUEST['ccity'];
$cstate = $_REQUEST['cstate'];
$czip = $_REQUEST['czip'];
$cbirthday = $_REQUEST['cbirthday'];
$medmemid = $_REQUEST['medmemid'];
$medclaim = $_REQUEST['medclaim'];
$marital = $_REQUEST['marital'];
$income = $_REQUEST['income'];
$gender = $_REQUEST['gender'];
$race = $_REQUEST['race'];
$caregiver = $_REQUEST['caregiver'];
$relationship = $_REQUEST['relationship'];
$memphone = $_REQUEST['memphone'];
$physician = $_REQUEST['physician'];
$phyphone = $_REQUEST['phyphone'];
session_start();
$_SESSION['rname'] = $rname;
$_SESSION['rdate'] = $rdate;
$_SESSION['ragency'] = $ragency;
$_SESSION['rphone'] = $rphone;
$_SESSION['cname'] = $cname;
$_SESSION['cphone'] = $cphone;
$_SESSION['caddress'] = $caddress;
$_SESSION['ccity'] = $ccity;
$_SESSION['cstate'] = $cstate;
$_SESSION['czip'] = $czip;
$_SESSION['cbirthday'] = $cbirthday;
$_SESSION['medmemid'] = $medmemid;
$_SESSION['medclaim'] = $medclaim;
$_SESSION['marital'] = $marital;
$_SESSION['income'] = $income;
$_SESSION['gender'] = $gender;
$_SESSION['race'] = $race;
$_SESSION['caregiver'] = $caregiver;
$_SESSION['relationship'] = $relationship;
$_SESSION['memphone'] = $memphone;
$_SESSION['physician'] = $physician;
$_SESSION['phyphone'] = $phyphone;
header ('location:referraldone.php?say=blankfields');
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table style="text-align:left; width: 500px; left:45px; position:relative; padding:2px; border:1px solid #1A1A1A">
<tr>
<td colspan="2" style="vertical-align:top; text-align:center; border:1px solid #1A1A1A; background-color:#A52A2A; color:#FFFFFF;">REFERRAL FORM</td>
</tr>
<tr>
<td colspan="2"><center>Choose us as your Home Care Agency!<br />We provide services 24 hours per day, 7 days a week.<br /><br />Please submit form below and your respond time<br />will be 48 hours.<br /><br /><strong>*Bold Fields Required</strong><br /><br /></td>
</tr>
<tr>
<td valign="top">Reffered By:<br /><input name="rname" type="text" value="<?php echo $rname; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Reffered Date:<br /><input name="rdate" type="text" value="<?php echo $rdate; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Reffered Agency:<br /><input name="ragency" type="text" value="<?php echo $ragency; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Phone:<br /><input name="rphone" type="text" style=value="rphone" "width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Client Name:</strong><br /><input name="cname" type="text" value="<?php echo $cname; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Phone:</strong><br /><input name="cphone" type="text" value="<?php echo $cphone; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Address:</strong><br /><input name="caddress" type="text" value="<?php echo $caddress; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* City:</strong><br /><input name="ccity" type="text" value="<?php echo $ccity; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* State:</strong><br /><input name="cstate" type="text" value="<?php echo $cstate; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Zip Code:</strong><br /><input name="czip" type="text" value="<?php echo $czip; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br /><strong>* Birthday:</strong><br /><input name="cbirthday" type="text" value="<?php echo $cbirthday; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Medicaid Member ID:<br /><input name="medmemid" type="text" value="<?php echo $medmemid; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Medicare Claim:<br /><input name="medclaim" type="text" value="<?php echo $medclaim; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Marital Status:<br /><input name="marital" type="text" value="<?php echo $marital; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Monthly Income:<br /><input name="income" type="text" value="<?php echo $income; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Gender:<br /><input name="gender" type="text" value="<?php echo $gender; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Race:<br /><input name="race" type="text" value="<?php echo $race; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Caregiver Name:<br /><input name="caregiver" type="text" value="<?php echo $caregiver; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Relationship:<br /><input name="relationship" type="text" value="<?php echo $relationship; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Phone:<br /><input name="memphone" type="text" value="<?php echo $phone; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Physician:<br /><input name="physician" type="text" value="<?php echo $physician; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top"><br />Phone:<br /><input name="phyphone" type="text" value="<?php echo $phyphone; ?>" style="width:98%" /></td>
</tr>
<tr>
<td valign="top" style="color:#C00000"><br />Please make sure all the <strong>BOLD</strong> fields are completed before submitting form.<br /><br /></td>
</tr>
<tr>
<td align="right"><input type="reset" value="Clear Fields"> <input type="submit" name="send" value="Send" /></td>
</tr>
</table>
</form>
あなたは冗談でしょうか? **のようなコード**の壁を投稿することは、質問するのに便利な方法ではありません。それを問題を示す最小限のコードに分解してください。 –
ああ...そのコードが問題です。セッションは何らかの理由で登録されていません。それを確認してください。 – yanike
申し訳ありません@yanike、これは基本的なデバッグとはるかに詳細なエラーの説明を最初に要求します。正確には何がうまくいかず、どの時点でですか? –