Get values of checkbox to other page - php

I have this code:
<table class="table table-bordered">
<thead>
<tr>
<th class="thheader">Monday</th>
<th class="thheader">Tuesday</th>
<th class="thheader">Wednesday</th>
<th class="thheader">Thursday</th>
<th class="thheader">Friday</th>
</tr>
</thead>
<?php
$available = array();
while ($row3 = mysqli_fetch_assoc($result3))
{
$dayt = $row3['day_of_week'];
$times = $row3['time_window_label'];
$tt= explode(",",$times);
$available[$dayt][] = trim($tt[1]);
}
for ($x=0; $x<3; $x++)
{
?>
<tr>
<td>
<center>
<?php
if($available[1][$x] != ''){
$counter++;?>
<input type="checkbox" class="colour-button choice1 daypicker1" day="1" name="val1" value="<?php echo #$tt[1]?>" id="btn112<?php echo $counter;?>" /><label for="btn112<?php echo $counter;?>"> <i class="fa fa-check-circle hide12" id="chk-btn112<?php echo $counter;?>"></i> <?php echo #$available[1][$x];?></label>
<?php }?>
</center>
</td>
<td>
<center>
<?php if($available[2][$x] != ''){
$counter++;?>
<input type="checkbox" class="colour-button choice2 daypicker2" day="2" name="val2" value="<?php echo #$tt[1]?>" id="btn1012<?php echo $counter;?>" /><label for="btn1012<?php echo $counter;?>"> <i class="fa fa-check-circle hide13" id="chk-btn1012<?php echo $counter;?>"></i> <?php echo #$available[2][$x];?></label>
<?php }?>
</center>
</td>
<td>
<center>
<?php if($available[3][$x] != ''){
$counter++;?>
<input type="checkbox" class="colour-button choice3 daypicker3" day="3" name="val3" value="<?php echo #$tt[1]?>" id="btn102<?php echo $counter;?>" /><label for="btn102<?php echo $counter;?>"> <i class="fa fa-check-circle hide14" id="chk-btn102<?php echo $counter;?>"></i> <?php echo #$available[3][$x];?></label>
<?php }?>
</center>
</td>
<td>
<center>
<?php if($available[4][$x] != ''){
$counter++;?>
<input type="checkbox" class="colour-button choice4 daypicker4" day="4" name="val4" value="<?php echo #$tt[1]?>" id="btn1032<?php echo $counter;?>" /><label for="btn1032<?php echo $counter;?>"> <i class="fa fa-check-circle hide15" id="chk-btn1032<?php echo $counter;?>"></i> <?php echo #$available[4][$x];?></label>
<?php }?>
</center>
</td>
<td>
<center>
<?php if($available[5][$x] != ''){
$counter++;?>
<input type="checkbox" class="colour-button choice5 daypicker5" day="5" name="val5" value="<?php echo #$tt[1]?>" id="btn1042<?php echo $counter;?>" /><label for="btn1042<?php echo $counter;?>"> <i class="fa fa-check-circle hide16" id="chk-btn1042<?php echo $counter;?>"></i> <?php echo #$available[5][$x];?></label>
<?php }?>
</center>
</td>
</tr>
<?php }?>
</table>
It is inside a form, and when I click submit I want to be able to get the values that are in the form. The problem I'm facing is that my rows are dynamic, for example here is my outcome:
These are checkboxes, and the user is only allowed to pick one per day. However when I send the form this is how I tried getting the values:
$value1 = $_POST['val1'];
$value2 = $_POST['val2'];
$value3 = $_POST['val3'];
$value4 = $_POST['val4'];
$value5 = $_POST['val5'];
echo $value1;die;
However my output is only 5AM-8AM all the time, it is never 9AM-12PM even if I chose it. it is always the first time on the row. How can I fix this?

Related

Checkbox in PHP foreach loop - all checkboxes activate the 1st

I have a foreach loop providing data to a html table. I have added a form around the table and on each row am adding an input/checkbox with the value set as the row_id from the db call.
When clicking on the first checkbox it selects, when clicking on other rows the 1st checkbox in the table selects not the row you intended.
I was under the impression that setting the name="whatever[]" like so adds the checkbox to an array? So in the form processor I can get it via $_POST['checkbox'] array. Which is working on the form processor part.
I am using bootstrap to style everything so this might be an issue?
I can't for the life of me seem to be able to fix the click one checkbox get only the first checked.
This is my table code:
<form action="<?php echo URLROOT.'/admin/voyage/sendemail'; ?>" method="POST">
<table id="volunteers" class="table table-bordered text-secondary">
<thead class="bg-msp-lightgrey">
<tr>
<th width="35px">
</th>
<th>
Volunteer
</th>
<th>
Position
</th>
<th>
DBS Status
</th>
<th>
Last Training
</th>
<th>
Last Refit
</th>
<th>
Contact
</th>
<th>
Form
</th>
</tr>
</thead>
<tbody>
<?php foreach ($data['volunteerData'] as $volunteer) : ?>
<?php
$result = 'DBS Form to be sent';
$order = 0;
if ($volunteer->volunteer_dbsSent) {
$result = 'DBS Form sent to volunteer - '.date('d/m/Y', strtotime($volunteer->volunteer_dbsSent));
$order = 1;
}
if ($volunteer->volunteer_dbsReceived) {
$result = 'DBS Form returned to us - '.date('d/m/Y', strtotime($volunteer->volunteer_dbsReceived));
$order = 2;
}
if ($volunteer->volunteer_dbsASTO) {
$result = 'DBS Form sent to ASTO - '.date('d/m/Y', strtotime($volunteer->volunteer_dbsASTO));
$order = 3;
}
if ($volunteer->volunteer_dbsReturned) {
$result = 'DBS returned - '.date('d/m/Y', strtotime($volunteer_dbsReturned));
$order = 4;
}
if ($volunteer->volunteer_dbsClear) {
$result = 'DBS clear, cert number: - '.$volunteer->volunteer_dbsCertNum;
$order = 5;
}
?>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="check" name="check[]" value="<?php echo $volunteer->volunteer_id; ?>" />
<label class="custom-control-label" for="check"></label>
</div>
</td>
<td>
<a class="text-msp-lightblue" href="<?php echo URLROOT.'/admin/volunteer/manage/'.$volunteer->volunteer_id; ?>"><?php echo $volunteer->volunteer_firstName.' '.$volunteer->volunteer_lastName; ?></a>
</td>
<td>
<?php echo $volunteer->volunteer_rank; ?>
</td>
<td data-sort="<?php echo $order; ?>">
<?php echo $result; ?>
</td>
<td>
</td>
<td>
</td>
<td>
<a class="text-msp-lightblue" href="mailto:<?php echo $volunteer->volunteer_email; ?>"><?php echo $volunteer->volunteer_email; ?></a><br />
<a class="text-msp-lightblue" href="tel:<?php echo $volunteer->volunteer_mobile; ?>"><?php echo $volunteer->volunteer_mobile; ?></a>
</td>
<td>
<a target="_blank" class="text-msp-lightblue" href="<?php echo URLROOT.'/admin/volunteer/volunteerForm/'.$volunteer->volunteer_id; ?>">View</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="row mt-4">
<div class="col-5">
<div class="input-group">
<select class="custom-select" id="email" name="email">
<option selected>Update DBS Status...</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
</select>
<div class="input-group-append">
<button class="btn btn-msp-lightblue text-white" type="submit"><i class="fas fa-paper-plane"></i> Send</button>
</div>
</div>
</div>
</div>
</form>
Try this code. Added new variable $type= ""; and passed in checkbox array.
<input type="checkbox" class="custom-control-input" id="check_<?php echo $Inc;?>" name="check[<?php echo $type;?>][]" value="<?php echo $volunteer->volunteer_id; ?>" />
Checkbox Id also made unique.
<tbody>
<?php
$Inc = 1;
foreach ($data['volunteerData'] as $volunteer) : ?>
<?php
$result = 'DBS Form to be sent';
$order = 0;
$type= "";
if ($volunteer->volunteer_dbsSent) {
$result = 'DBS Form sent to volunteer - '.date('d/m/Y', strtotime($volunteer->volunteer_dbsSent));
$order = 1;
$type= "dbsSent";
}
if ($volunteer->volunteer_dbsReceived) {
$result = 'DBS Form returned to us - '.date('d/m/Y', strtotime($volunteer->volunteer_dbsReceived));
$order = 2;
$type= "dbsReceived";
}
if ($volunteer->volunteer_dbsASTO) {
$result = 'DBS Form sent to ASTO - '.date('d/m/Y', strtotime($volunteer->volunteer_dbsASTO));
$order = 3;
$type= "dbsASTO";
}
if ($volunteer->volunteer_dbsReturned) {
$result = 'DBS returned - '.date('d/m/Y', strtotime($volunteer_dbsReturned));
$order = 4;
$type= "dbsReturned";
}
if ($volunteer->volunteer_dbsClear) {
$result = 'DBS clear, cert number: - '.$volunteer->volunteer_dbsCertNum;
$order = 5;
$type= "dbsClear";
}
?>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="check_<?php echo $Inc;?>" name="check[<?php echo $type;?>][]" value="<?php echo $volunteer->volunteer_id; ?>" />
<label class="custom-control-label" for="check"></label>
</div>
</td>
<td>
<a class="text-msp-lightblue" href="<?php echo URLROOT.'/admin/volunteer/manage/'.$volunteer->volunteer_id; ?>"><?php echo $volunteer->volunteer_firstName.' '.$volunteer->volunteer_lastName; ?></a>
</td>
<td>
<?php echo $volunteer->volunteer_rank; ?>
</td>
<td data-sort="<?php echo $order; ?>">
<?php echo $result; ?>
</td>
<td>
</td>
<td>
</td>
<td>
<a class="text-msp-lightblue" href="mailto:<?php echo $volunteer->volunteer_email; ?>"><?php echo $volunteer->volunteer_email; ?></a><br />
<a class="text-msp-lightblue" href="tel:<?php echo $volunteer->volunteer_mobile; ?>"><?php echo $volunteer->volunteer_mobile; ?></a>
</td>
<td>
<a target="_blank" class="text-msp-lightblue" href="<?php echo URLROOT.'/admin/volunteer/volunteerForm/'.$volunteer->volunteer_id; ?>">View</a>
</td>
</tr>
<?php
$Inc++;
endforeach; ?>
</tbody>

set two different type checkbox color in the form using php codeigniter

<table class="table table-hover">
<tr>
<th>Sl.No</th>
<th> All </th>
<th>Regno.</th>
<th>Name</th>
<!--<?php echo "Core Subjects" ?> -->
<?php
foreach($getsubc as $rowc)
{
?>
<td align="center">
<?php echo $rowc['subcode']; ?>
<input type="checkbox" id="check-all" onClick="toggle(this,<?php echo $rowc['markid']; ?>)" value="<?php echo $rowc['markid']; ?>" checked="checked" data-checkbox-class="icheckbox_square-green">
</td>
</div>
<?php
}
?>
<!-- Elective subjects -->
<?php
foreach($getsube as $rowe)
{
?>
<td align="center">
<?php echo $rowe['subcode']; ?>
<input type="checkbox" id="check-all2" onClick="toggle(this,<?php echo $rowe['markid']; ?>)" value="<?php echo $rowe['markid']; ?>" data-checkbox-class="icheckbox_square-blue">
</td>
<?php
}?>
</tr>
<?php
$sno=1;
foreach($getstud as $row)
{
echo '<tr>'; ?>
<?php
echo '<td>'.$sno++.'</td>';
echo '<td><input type="checkbox" value="' . $row['regno'] . '" name="regno[]"></td>';
echo '<td>'.$row['regno'].'</td>';
echo '<td>'.$row['name'].'</td>';
?>
<?php ?>
<?php foreach($getsubc as $row1)
{?>
<td align="center"> <input type="checkbox" data-checkbox-class="icheckbox_square-green" name="friend_id[]"
value="<?php echo $row1['markid'];?>" >
</td>
</td>
</div>
</td>
</div>
</div>
<?php
} ?>
<?php
foreach($getsube as $row2)
{
?>
<td align="center"> <input type="checkbox" data-checkbox-class="icheckbox_square-blue" name="friend_id[]" value="<?php echo $row2['markid']; ?>" /> </td>
<?php
}
echo '</tr>';
}
?>
</table>
<script src="<?= base_url('assets/plugins/iCheck/icheck.min.js') ?>"></script>
$('input:checkbox').iCheck({
increaseArea: '25%' // optional
});
</script>
<script language="JavaScript">
function toggle(source, markid) {
checkboxes = document.getElementsByName(markid);
for(var i=0, n=checkboxes.length;i<n;i++) {
checkboxes[i].checked = source.checked;
}
}
</script>
i changes the code accordingly your solution . but not working both color and select_all method . whats wrong with this code
i changes the code accordingly your solution . but not working both color and select_all method . whats wrong with this code
i changes the code accordingly your solution . but not working both color and select_all method . whats wrong with this code
First, change your iCheck initialization to this:
$('input:checkbox').iCheck({
increaseArea: '25%' // optional
});
Then do this on first set:
<td align="center">
<?php echo $row1['subcode']; ?>
<input type="checkbox" id="check-all" onClick="toggle(this,<?php echo $row1['markid']; ?>)" value="<?php echo $row1['markid']; ?>" checked="checked" data-checkbox-class="icheckbox_square-green">
</td>
And then on your second set:
<td align="center">
<?php echo $row2['subcode']; ?>
<input type="checkbox" id="check-all2" onClick="toggle(this,<?php echo $row2['markid']; ?>)" value="<?php echo $row2['markid']; ?>" data-checkbox-class="icheckbox_square-blue">
</td>
Notice the use of data-checkbox-class attribute on each of the input:checkbox tags. Which you can apply the same on the ones within data tables.

Unable to show checked radio button inside table

I am trying to get a radio button checked based on the data that was passed from the server to the view. However I cannot get the radio button to be checked inside a bootstrap table. The following is my code:
<tbody>
<?php
foreach($results as $row)
{
?>
<tr>
<td><?php echo $row->productCoverNoteNo ?></td>
<td><?php echo $row->productClass ?></td>
<td><?php echo $row->productName ?></td>
<td><?php echo $row->productPolicyNo ?></td>
<td>
<input type="radio" name="tbx_paymentStatus" id="paid" value="PAID" <?php if ($row->productPaymentStatus == "UNPAID"){ echo "checked='checked'"; }?> />
<label for="paid">Paid</label></br>
<input type="radio" name="tbx_paymentStatus" id="unpaid" value="UNPAID" <?php if ($row->productPaymentStatus == "PAID"){ echo "checked='checked'"; }?> />
<label for="unpaid">Unpaid</label>
</td>
<td><a title="Edit this customer product" href="<?php echo base_url("customerProduct/editCustomerProduct/$row->productCoverNoteNo") ?>"><i class="fa fa-pencil fa-lg"></i></a>
| <a title="View endorsements of this customer product" href="<?php echo base_url("endorsement/viewEndorsement/$row->productCoverNoteNo") ?>"><i class="fa fa-book fa-lg"></i></a></td>
</tr>
<?php echo($row->productPaymentStatus);
}
?>
</tbody>
Try this:
<input type="radio" name="tbx_paymentStatus" id="paid" value="PAID"
<?php if ($row->productPaymentStatus == "UNPAID"){ ?> checked='checked' <?php }?> />

Parse error: syntax error, unexpected 'else' (T_ELSE) in php

Hey guys I m having a tricky issue but unable to get out of it.
Here I m providing a radio button with namely two option free or paid registration but when I going in else part I m receiving an error.
I checked out the syntax line by line still it is unable to resolve why I m getting and error for else.
Please check and help me out.
<?php $regtype = (isset($postdata['regtype']))? $postdata['regtype']:0;?>
Registration Type: <?php echo $form->radio("regtype",array('0' => $translate->_("Free"),'1' =>$translate->_("Paid")),array('separator'=>"\n",'value'=>$regtype));?>
<?php $type = $_POST['data[regtype]'];?>
<?php if ($type == "Free")
?>
<form action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="POST">
<?php if($agency['monthly_fee'] != ''):?>
<?php echo $form->hidden("monthly_fee",array('value'=>$agency['monthly_fee']));?>
<?php endif;?>
<table class="list" border="0" cellspacing="0" cellpadding="0">
<tr>
<th width="200">Plan</th>
<td>
<?php $a="Monthly Rs.600"; $b="3 months Rs. 1,650"; $c="12 months Rs. 6,000"; ?>
<?php echo $form->select("plan",array($a=>'Monthly Rs.600',$b=>'3 months Rs. 1,650',$c=>'12 months Rs. 6,000'),$postdata["plan"]);?>
</td>
</tr>
<tr>
<th width="200"><?php echo $translate->_("student_master_name");?></th>
<td>
<?php echo $translate->_("student_master_name1");?>:<?php echo $form->text("name1",array('value'=>$postdata["name1"]));?>
<?php echo $translate->_("student_master_name2");?>:<?php echo $form->text("name2",array('value'=>$postdata["name2"]));?>
</td>
</tr>
<?php if($gl_locale=="ja"):?>
<tr>
<th>ローマ字</th>
<td>
Surnames:<?php echo $form->text("roma1",array('value'=>$postdata["roma1"]));?>
Given names:<?php echo $form->text("roma2",array('value'=>$postdata["roma2"]));?>
</td>
</tr>
<?php endif;?>
<tr>
<th scope="row"><?php echo $translate->_("student_master_gender");?></th>
<td>
<?php $gender = (isset($postdata['gender']))? $postdata['gender']:0;?>
<?php echo $form->radio("gender",array('0' => $translate->_("common_male"),'1' =>$translate->_("common_female")),array('separator'=>"\n",'value'=>$gender));?>
</td>
</tr>
<tr>
<th scope="row"><?php echo $translate->_("student_master_birth");?></th>
<td>
<?php echo $form->year("birth",1900,date("Y"),$postdata['birth_year'],array('name'=>'data[birth_year]'),"----"); ?><?php echo $translate->_("common_year");?>
<?php echo $form->month("birth",$postdata['birth_month'],array('name'=>'data[birth_month]'),"--");?><?php echo $translate->_("common_month");?>
<?php echo $form->day("birth",$postdata['birth_day'],array('name'=>'data[birth_day]'),"--");?><?php echo $translate->_("common_day");?>
</td>
</tr>
<tr>
<th><?php echo $translate->_("student_master_country");?></th>
<td>
<?php echo $form->select("country_id",$country_data,$postdata['country_id'],array('id'=>'country'),$translate->_("common_choose"));?>
</td>
</tr>
<tr>
<th><?php echo $translate->_("student_master_email");?></th>
<td><?php echo $form->text("email",array('id'=>'mail','value'=>$postdata['email'])); ?></td>
</tr>
<tr>
<th width="200"><?php echo $translate->_("student_master_login_id");?></th>
<td><?php echo $form->text("login_id",array('class'=>'required ||','value'=>$postdata['login_id']));?> <?php echo $translate->_("bmat-entry-tdtxt");?></td>
</tr>
<tr>
<th><?php echo $translate->_("student_master_login_password");?></th>
<td><?php echo $form->password("login_password",array('class'=>'required ||','value'=>$postdata['login_password']));?></td>
</tr>
<tr>
<th><?php echo $translate->_("student_master_login_password");?>(<?php echo $translate->_("bmat-entry-thtxt");?>)</th>
<td><?php echo $form->password("login_password_cfm",array('class'=>'required ||','value'=>$postdata['login_password_cfm']));?></td>
</tr>
</table>
<?php if(!isset($postdata['c-code'])) $postdata['c-code'] = $coupon_code;?>
<?php echo $form->hidden("c-code",array('class'=>'||','value'=>$postdata['c-code']));?>
<?php echo $form->hidden('MemberInfoToken',array('value'=>$MemberInfoToken))?>
<?php echo $form->hidden('stat',array('value'=>'confirm'))?>
<?php //echo $form->hidden('entry_date',array('value'=>date('Y/m/d')))?>
<?php if($gl_locale == 'ja'):?>
<h3><?php echo $translate->_("bmat-entry-kiyaku");?></h3>
<div id="agreement" class="mrg-t10">
<p class="mrg-t10" style="font-weight:bold;">第1条(本規約の適用)</p>
<p>1. 本規約はイープランニング(以下当社という)が運営する特定ドメイン上のウェブサイト 「B-MAT」(以下当社ウェブサイトという)において提供する教育プログラムサービス(以下本サービスという)を、利用者 (第2条にて定義します)が利用する場合の遵守すべき諸条件を定めるものです。</p>
<p>2. 当社は、本サービスの各々について適宜、個別の利用規約(以下「個別規 約」といいます)を定めることができるものとします。</p>
<p style="font-weight:bold;">第2条(ご利用条件について)</p>
<p>利用者には、当社が当該利用者の利用登録を承認した時点で、当社が提供する本サー ビスを利用する資格(以下、「利用者資格」といいます)が与えられます。<br />
利用者は、本利用規約の他、当社が定める各種の規約(以下、「個別規程」といいます)に同意頂き、本サービ スをご利用ください。 なお、本利用規約と個別規程の定めが異なる場合には、個別規程の定めが優先するものとします。<br />
本利用規約および個別規程(以下、併せて「本利用規約等」といいます)については、利用者に対する事前の通 知なく、当社が変更できるものとします。 本利用規約等が変更された場合、当該変更後の利用者による本サービスの利用に は変更後の本利用規約等が適用されるものとし、当該利用により、利用者は当該変更に同意したものとみなされます。</p>
<p style="font-weight:bold;">第3条(著作権について)</p>
<p>本Webサイトに掲載されている著作物(文書、資料、画像、音声、動画等)の著作権は、 イープランニングまたはその他の権利者に帰属します。 これらの著作物につきましては、別段の定めがある場合を除き、私的 使用その他著作権法で特に認められている範囲を超えてご利用(複製、改変、上映、公衆送信、頒布、再使用許諾等を含 む)はできません。 仮に、営利目的でご使用になった場合、相応の使用料をいただくか、使用差し止めの処置を取る場合もあ りますのでご注意ください。</p>
<p style="font-weight:bold;">第4条(利用上の注意)</p>
<p>利用者は、利用に際して登録した情報(以下、「登録情報」といいます。メールアドレス やパスワード等を含みます)について、自己の責任の下、任意に登録、管理するものとします。 利用者は、第三者にパスワ ードを使用されることのないよう、以下の事項を守らなければなりません。</p>
<p>・第三者に自己のパスワードを公開しないこと。<br />
・複数の人間が使用するコンピュータならびに携帯電話上で本サービスを利用する場合は、本 サービスの利用を終えるときに必ずログアウトしウェブブラウザを終了させること。<br />
・複数の人間が使用するコンピュータ上で本サービスを利用する場合は、ログイン情報記録(ログイン時のメールアド レスとパスワードの入力を省略できる機能)の登録解除を行っておくこと。<br />
・当社は、登録されたパスワードによって本サービスの利用があった場合、利用登録をおこな った本人が利用したものと扱うことができ、当該利用によって生じた結果ならびにそれに伴う一切の責任については、利用登録 を行った本人に帰属するものとします。<br />
登録情報の管理は、利用者が自己の責任の下で行うものとし、登録情報が不正確または虚偽であったために利用 者が被った一切の不利益および損害に関して、当社は責任を負わないものとします。</p>
<p style="font-weight:bold;">第5条(個人情報について)</p>
<p>個人情報は、当社が別途定めるプライバシーポリシーに則り、適正に取り扱うこととしま す。 <br />
利用者の同意なく、機密保持契約を結んだ協力企業以外に利用者の個人情報を開示することはありません。ただ し、以下の場合に、個人情報を開示することがあります。</p>
<p>・法令に基づいて、開示が必要であると当社が合理的に判断した場合<br />
・人の生命、身体または財産の保護のために必要がある場合であって、本人の同意を得るこ とが困難であると判断した場合<br />
・公衆衛生の向上または児童の健全な育成の推進のために特に必要がある場合であって、本 人の同意を得ることが困難であると判断した場合<br />
・国の機関もしくは地方公共団体またはその委託を受けた者が法令の定める事務を遂行するこ とに対して協力する必要がある場合であって、本人の同意を得ることにより当該事務の遂行に支障を及ぼすおそれがあると判断 した場合<br />
・合併その他の事由によりサービスの主体が変更され、サービスの継続のため個人情報を移管する必要があると判断した場合</p>
<p>ワールドカップおよびワールドカップJrに入賞した場合は、名前と国名のみ当サイトのワールドカップサイト内に表示します。</p>
<p style="font-weight:bold;">第6条(免責)</p>
<p>・何らかの原因によるシステム障害が起こった場合、その時の獲得ポイントや賞品が無効となる場合があります。<br />
・ポイント獲得および商品交換など、諸所のルールが途中で変更になる場合があります。 </p>
</div><!--agreement-->
<div id="agree-chk">
<input type="hidden" name="data[agree]" value="0">
<label><input name="data[agree]" type="checkbox" value="1"> <?php echo $translate->_("bmat-entry-doui");?></label>
</div>
<?php else:?>
<input type="hidden" name="data[agree]" value="1">
<?php endif;?>
<div style="text-align:center" class="mrg-t10">
<input type="button" name="back" value=" <?php echo $translate->_("otn_member_entry_index_back");?> " onclick="history.back();"/>
<input type="submit" name="btnSubmit" value=" <?php echo $translate->_("otn_member_entry_index_confirm");?> " />
</div>
<?php endif;?>
</form>
<?php else:?> **<!-- Here I m getting an error -->**
<label>In paid registration</label>
<?php endif;?>
Looks like you might have an extra end if:
<?php else:?>
<input type="hidden" name="data[agree]" value="1">
<?php endif;?>
<div style="text-align:center" class="mrg-t10">
<input type="button" name="back" value=" <?php echo $translate->_("otn_member_entry_index_back");?> " onclick="history.back();"/>
<input type="submit" name="btnSubmit" value=" <?php echo $translate->_("otn_member_entry_index_confirm");?> " />
</div>
<?php endif;?>

Why does my output wont update when i hit the update button? any suggestions and codes about this?

Why does my output wont update what seems to be the problem? sorry im just new in php can someone help in this?and i want to make a search bar not a dropdown menu im so frustrated in this codes help please
Childs Name:<?php
$name= mysql_query("select * from persons ORDER BY name");
echo '<select name="name" id="user" class="textfield1">';
while($res= mysql_fetch_assoc($name))
{
echo '<option value="'.$res['id'].'">';
echo $res['name'];
echo'</option>';
}
echo'</select>';
?>
</div>
<br />
<div style="margin-left: 97px;">information:
<input name="name" type="text" value="" /></div>
<div style="margin-left: 127px; margin-top: 14px;"><input name="" type="submit" value="Update" /></div>
My table
<div class="content" id="registry"><br><br>
<table width="100%">
<tr class="head">
<th>Date of entry</th>
<th>Date of Baptisim</th>
<th>Name of the Child</th>
<th>Birthday</th>
<th>Mother</th>
<th>Father</th>
<th>Mother's Address</th>
<th>Father's Address</th>
<th>Current Address</th>
<th>Ninong/Ninang</th>
<th>Amount Paid</th>
<th>Priest</th>
</tr>
<?php
$sql=mysql_query("select * from persons ORDER BY name");
$i=1;
while($row=mysql_fetch_array($sql))
{
$da=$row['da'];
$entry=$row['entry'];
$name=$row['name'];
$bday=$row['bday'];
$mot=$row['mot'];
$fat=$row['fat'];
$motadd=$row['motadd'];
$fatadd=$row['fatadd'];
$ca=$row['ca'];
$nn=$row['nn'];
$paid=$row['paid'];
$priest=$row['priest'];
if($i%2)
{
?>
<tr id="<?php echo $id; ?>" class="edit_tr">
<?php } else { ?>
<tr id="<?php echo $id; ?>" bgcolor="#f2f2f2" class="edit_tr">
<?php } ?>
<td class="edit_td">
<span class="text"><?php echo $da; ?></span>
</td>
<td>
<span class="text"><?php echo $entry; ?></span>
</td>
<td>
<span class="text"><?php echo $name; ?></span>
</td>
<td>
<span class="text"><?php echo $bday; ?></span>
</td>
<td>
<span class="text"><?php echo $mot; ?></span>
</td>
<td>
<span class="text"><?php echo $fat; ?></span>
</td>
<td>
<span class="text"><?php echo $motadd; ?></span>
</td>
<td>
<span class="text"><?php echo $fatadd; ?></span>
</td>
<td>
<span class="text"><?php echo $ca; ?></span>
</td>
<td>
<span class="text"><?php echo $nn; ?></span>
</td>
<td>
<span class="text"><?php echo $paid; ?></span>
</td>
<td>
<span class="text"><?php echo $priest; ?></span>
</td>
</tr>
<?php
$i++;
}
?>
</table>
your code is very strange to say the least, by the looks of it you have a submit input and a name input but this is not being submitted anywhere.. first you want a form to post to example.php
<form action="example.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
then from example.php you would want to run an update query using the data from your form:
$sql = "UPDATE mytable SET value = '{$value}' WHERE id = {$id}";
i suggest you look up a tutorial on how to update using php here

Categories