I am making a quiz app and one question must be correct. I can already insert multiple data in my table, the problem that i have is, I have a one specific choice or answer that must be different from the others.
A screenshot of the app and what im trying to do
Here's what my table looks like
table answers
id | answer | correct
1 | Apple | 1
2 | Mango | 0
3 | Melon | 0
1, indicate for correct answer and 0 indicate for incorrect.
So here is my Model.
I tried to make an attempt to fetch the radio button value which is the 1 value and insert it to the database but the result was, IF I add another data or multiple data. Index 0 or the first data was the only data that can be inserted. I CANNOT choose what radio button i can check only the FIRST button I can check.
// Insert questions
$field_question = array(
'question'=>$this->input->post('question'),
);
$this->db->insert('questions', $field_question);
// Insert Answers
$data_answer = $this->input->post('choice[]');
$data_is_correct = $this->input->post('checkChoice[]');
$value = array();
for($i = 0; $i < count($data_answer); $i++) {
$value[$i] = array(
'answer' => $data_answer[$i],
'correct' => $data_is_correct[$i],
'question_id' => $this->db->insert_id(),
);
}
$this->db->insert_batch('answers', $value);
if($this->db->affected_rows() > 0){
return true;
}else{
return false;
}
Problem of my table if I add 3 new data
id | answer | correct
1 | Apple | 1
2 | Mango | 0
3 | Melon | 0
* New 3 Data Inserted
4 | Orange | 1
5 | Tomato | 0
6 | Grapes | 0
I cannot makeTomato or Grapes to be my answer or make it as value number 1 only Orange or the first added data.
VIEW
So here is my radio button
<div class="form-check">
<input class="form-check-input" type="radio" name="checkChoice[]" id="checkChoice" value="1" checked />
<label class="form-check-label" for="exampleRadios1">
Make this as an Answer
</label>
</div>
And my form.
<form method="post" id="myForm" action="<?php echo base_url(); ?>posts/addQuestion">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">Question</span>
</div>
<input type="text" placeholder="Enter your Question" name="question" id="question" class="form-control" required />
</div>
<hr>
<h5>Create Choices: </h5>
<div class="input-group input-group-sm mb-3">
<div class="table-responsive">
<table class="table table-bordered" id="dynamic_field">
<tr>
<td><input type="hidden" name="choiceHid[]" value="0" /></td>
<td><input type="text" name="choice[]" id="choice" placeholder="Enter your Choice" class="form-control" /> </td>
<td><button type="button" name="add" id="add" class="btn btn-success"><span class="iconify" data-icon="ant-design:plus-circle-outlined" data-inline="false"></span> Add Response </button></td>
<td>
<div class="form-check">
<input class="form-check-input" type="radio" name="checkChoice[]" id="checkChoice" value="1" checked />
<label class="form-check-label" for="exampleRadios1">
Make this as an Answer
</label>
</div>
</td>
</tr>
</table>
</div>
</div>
<hr>
<input type="button" id="btnSave" class="btn btn-block btn-info" value="Submit" />
</form>
Script
<script>
$('#btnSave').click(function(){
var url = $('#myForm').attr('action');
var data = $('#myForm').serialize();
//validate form
$.ajax({
type: 'ajax',
method: 'post',
url: url,
data: data,
async: false,
dataType: 'json',
success: function(response){
if(response.success){
$('#myForm')[0].reset();
if(response.type=='add'){
var type = 'added'
}
swal("Success!", "You created a Question!", "success");
}else{
alert('Error');
}
},
error: function(){
alert('Could not add data');
}
});
});
</script>
Dynamic Field Script
<script>
$(document).ready(function(){
var i=1;
$('#add').click(function(){
i++;
$('#dynamic_field').append(
'<tr id="row'+i+'">'+
'<td><input type="hidden" name="choiceHid[]" value="0" /></td>'+
'<td><input type="text" name="choice[]" placeholder="Enter your Choice" class="form-control" /></td>'+
'<td><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove"><span class="iconify" data-icon="dashicons:remove" data-inline="false"></span></button></td>'+
'<td>'+
'<div class="form-check">'+
'<input class="form-check-input" type="radio" name="checkChoice[]" id="checkChoice" value="1" />'+
'<label class="form-check-label" for="exampleRadios1">'+
'Make this as an Answer'+
'</label>'+
'</div>'+
'</td>'+
'</tr>'
);
});
$(document).on('click', '.btn_remove', function(){
var button_id = $(this).attr("id");
$('#row'+button_id+'').remove();
});
});
</script>
Dynamic Field Script
make variable val as a value of checkChoice like following...
<script>
$(document).ready(function(){
var i=1;
$('#add').click(function(){
var val =i;
i++;
$('#dynamic_field').append(
'<tr id="row'+i+'">'+
'<td><input type="hidden" name="choiceHid[]" value="0" /></td>'+
'<td><input type="text" name="choice[]" placeholder="Enter your Choice" class="form-control" /></td>'+
'<td><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove"><span class="iconify" data-icon="dashicons:remove" data-inline="false"></span></button></td>'+
'<td>'+
'<div class="form-check">'+
'<input class="form-check-input" type="radio" name="checkChoice" id="checkChoice" value="'+val+'" />'+
'<label class="form-check-label" for="exampleRadios1">'+
'Make this as an Answer'+
'</label>'+
'</div>'+
'</td>'+
'</tr>'
);
});
$(document).on('click', '.btn_remove', function(){
var button_id = $(this).attr("id");
$('#row'+button_id+'').remove();
});
});
</script>
View
asign initial value of checkChoice as 0 like following
<div class="form-check">
<input class="form-check-input" type="radio" name="checkChoice" id="checkChoice" value="0" checked />
<label class="form-check-label" for="exampleRadios1">
Make this as an Answer
</label>
</div>
// Insert Answers
$data_answer = $this->input->post('choice[]');
$data_is_correct = $this->input->post('checkChoice');
$value = array();
for($i = 0; $i < count($data_answer); $i++) {
if($data_is_correct == $i) {
$correct = 1;
} else {
$correct = 0;
}
$value[$i] = array(
'answer' => $data_answer[$i],
'correct' => $correct,
'question_id' => $this->db->insert_id(),
);
}
I would like to change the value of a textarea and an input field. The whole thing should happen with an onclick. Unfortunately, my approach seems to be wrong. I would be happy about tips.
<textarea class="input" name="adresse" readonly="readonly" id="street" value="test"></textarea>
<input style="width:130px;text-align: left" class="input" type="text" name="kundennr" id="kundennr" value="10000">
<?php
$sql = "SELECT * FROM `kunde` ORDER BY `kundennummer` ASC";
foreach ($dbh->query($sql) as $nav) {
$address = $nav['adresse'];
$name = $nav['kundennummer'];
echo "
<input type='text' name='textfield' id='textfield$name' value='$address'>
<a> | Kundennr: </a><a href='#' id='text' onclick='updateTxt(this);' >$name</a><br>
";
}
?>
</div>
</div>
<script>
function updateTxt(el)
{
var inhalt = el.text;
var field2 = document.getElementById('textfield'+inhalt).value;
document.getElementById('kundennr').value =inhalt;
document.getElementById('street').innerHTML = field2;
}
</script>
Update:
Thanks to all I found the solution
Sorry, But can't run PHP code here so added dummy data as your PHP code will render.
This should work:
function updateTxt(el) {
var inhalt = el.innerHTML;
var field2 = document.getElementById('textfield' + inhalt).value;
document.getElementById('kundennr').value = inhalt;
document.getElementById('street').innerHTML = field2;
}
<textarea class="input" name="adresse" cols=50 rows=10 readonly="readonly" id="street" value=""></textarea>
<input style="width:130px;text-align: left" class="input" type="text" name="kundennr" id="kundennr" value="">
<!-- <?php
$sql = "SELECT * FROM `kunde` ORDER BY `kundennummer` ASC";
foreach ($dbh->query($sql) as $nav) {
$address = $nav['adresse'];
$name = $nav['kundennummer'];
echo "
<input type='text' name='textfield' id='textfield$name' value='$address'>
<a> | Kundennr: </a><a href='#' id='text' onclick='updateTxt(this);' >$name</a><br>
";
}
?> -->
<input type="text" name="textfield" id="textfieldstreet1" value="Add1..">
<a> | Kundennr: </a>street1<br>
<input type="text" name="textfield" id="textfieldstreet2" value="Add2...">
<a> | Kundennr: </a>street2<br>
<input type="text" name="textfield" id="textfieldstreet3" value="Add3...">
<a> | Kundennr: </a>street3<br>
<input type="text" name="textfield" id="textfieldstreet4" value="Add4...">
<a> | Kundennr: </a>street4<br>
I think you are looking for how to update an textarea value with JS. It is not the same as input field and can be done like this;
document.getElementById('myTextarea').value = ''New value";
where textarea is:
<textarea id="myTextarea">Initial value, will be overwritten</textarea>
I am adding rows using java script functions by taking input and showing data into input text fields.
I am using this datepicker https://github.com/T00rk/bootstrap-material-datetimepicker.
When I input time the only first value of time is copied into input fields while rest two value are copied but time value is not copied.
<div style="width:90%;margin:auto;">
<h1>Simple example of dynamically adding rows with jQuery</h1>
<form method="post">
<div id="itemRows">
Item quantity: <input type="text" name="add_qty" size="4" /> Item name: <input type="text" name="add_name" />Time:<input type="text" id="time" name="time" />
(This row will not be saved unless you click on "Add row" first)
<input onclick="addRow(this.form);" type="button" value="Add row" />
</div>
<p><input type="submit" name="ok" value="Save Changes"></p>
</form>
<script type="text/javascript">
var rowNum = 0;
function addRow(frm) {
rowNum ++;
var row = '<p id="rowNum'+rowNum+'">Item quantity: <input type="text" name="qty[]" size="4" value="'+frm.add_qty.value+'">Time<input type="text" id="time" name="time[]" size="4" value="'+frm.time.value+'" > Item name: <input type="text" name="name[]" value="'+frm.add_name.value+'"><input type="button" value="Remove" onclick="removeRow('+rowNum+');"></p>';
jQuery('#itemRows').append(row);
frm.add_qty.value = '';
frm.add_name.value = '';
frm.time.value = '';
}
function removeRow(rnum) {
jQuery('#rowNum'+rnum).remove();
}
</script>
When you generate dynamic textbox with id and with date picker so you need to call one function for init datepicker on that text like below
$('input').bootstrapMaterialDatePicker();
function addRow(frm)
{
rowNum ++;
var row = '<p id="rowNum'+rowNum+'">Item quantity: <input type="text" name="qty[]" size="4" value="'+frm.add_qty.value+'">Time<input type="text" id="time'+rowNum+'" name="time[]" size="4" value="'+frm.time.value+'" > Item name: <input type="text" name="name[]" value="'+frm.add_name.value+'"><input type="button" value="Remove" onclick="removeRow('+rowNum+');"></p>';
jQuery('#itemRows').append(row);
frm.add_qty.value = '';
frm.add_name.value = '';
frm.time.value = '';
$('#time'+rowNum).bootstrapMaterialDatePicker();
}
In above function i add one id to time textbox and call bootstrap datepicker to init date on that textbox.
See working demo here
http://plnkr.co/edit/P0ZQsAjDJAXyJGs9kvT3?p=preview
I have this form in the view:
<form method="POST" action="<?php echo Yii::$app->request->baseUrl;?>/telephone/addnow/" role="form" enctype="multipart/form-data">
<label>Upload your photo:</label><input type="file" name="image" ><br>
<input type="name" name="name" id="name" placeholder="Name" required><br><br>
<input type="text" name="address" placeholder="Address"><br><br>
<input type="text" name="telephone" placeholder="Telephone number" required>
<br><br>
<div id="dynamicInput">
<br><input type="text" name="myinputs[]" placeholder="Secondary Phone #1">
<span class="glyphicon glyphicon-plus" onClick="addInput('dynamicInput');"></span>
<br><br>
</div>
<input type="text" name="mobile" placeholder="Mobile number" > <br><br>
<input type="email" name="email" placeholder="Email">
<input type="email" name="altemail" placeholder="Alternative Email"><br><BR>
<input type="text" name="company_name" placeholder="Company Name"><br><BR>
<input type="text" name="company_address" placeholder="Company Address"><br><br>
<input type="text" name="company_phone_primary" placeholder="Company Telephone">
<input type="text" name="company_phone_secondary" placeholder="Telephone Secondary "><br><br>
<input type="text" name="company_email" placeholder="Company Email Address"><br><BR>
<button type="submit" class="btn btn-default">Submit</button><BR><BR>
</form>
allowing the user to insert any number of secondary phones i used this javascript code:
<script>
var counter = 1;
var limit = 10;
function addInput(divName) {
if (counter == limit) {
alert("You have reached the limit of adding " + counter + " inputs");
} else {
var newdiv = document.createElement('div');
newdiv.innerHTML = "Seconday Phone # " + (counter + 1) + " <br><input type='text' name='myinputs[]' placeholder='Secondary Phone '>";
document.getElementById(divName).appendChild(newdiv);
counter++;
}
}
</script>
And I have this controller code:
public function actionAddnow()
{
$request = Yii::$app->request;
$add=new telephone();
$add->Name=$request->post('name');
$add->Email=$request->post('email');
$add->Mobile=$request->post('mobile');
$add->Address=$request->post('address');
$add->Telephone=$request->post('telephone');
$add->altemail=$request->post('altemail');
$add->company_name=$request->post('company_name');
$add->company_address=$request->post('company_address');
$add->company_phone_primary=$request->post('company_phone_primary');
$add->company_phone_secondary=$request->post('company_phone_secondary');
$add->company_email=$request->post('company_email');
$add->save();
$getlast=Yii::$app->db->getLastInsertId();
$myinputs=$request->post('myinputs');
$totalinputs=sizeof('$myinputs');
for ($i=0; $i<=$totalinputs; $i++) {
$inputs=$myinputs[$i];
$phones=new phone();
$phones->secondary_phones=$inputs;
$phones->id=$getlast;
$phones->save();
}
return $this->redirect(Yii::$app->request->baseUrl.'/telephone/index');
}
but only the first two values of $myinputs are inserted in the database.
Putting variable $myinputs between single quotation marks ('$myinputs') you will convert your variable to string. sizeof is alias for count function, but as you give argument as string you allways get result as 1. After you will loop with condition ($i=0; $i<=$totalinputs; $i++) meaning that cycle will run 2 times when $i is 0 and when $i is 1.
Instead of:
$totalinputs=sizeof('$myinputs');
You should use
$totalinputs=sizeof($myinputs);
Another error is in your cycle condition.
for ($i=0; $i<=$totalinputs; $i++)
Should be
for ($i=0; $i<$totalinputs; $i++)
Or you could replace for cycle with foreach
foreach($myinputs as $inputs)
{
$phones=new phone();
$phones->secondary_phones=$inputs;
$phones->id=$getlast;
$phones->save();
}
On Yii side of improvements
1.For form you could use ActiveForm widget
$form = \yii\widgets\ActiveForm::begin([
'options' => [
"role" => "form",
"enctype"=> "multipart/form-data",
], ]);
echo $form->field($add, 'Name');
//etc
$form->end();
2.If you would use ActiveField for creating input fields in view or adding manually field names in format like ModelClassName[ModelFieldName], then you would be able to use Model load for assaign'ing values
Example:
$add=new telephone();
if ($add->load(Yii::$app->request->post()))
{
if ($add->save())
{//saved
}
else
{//error
}
}
else
{//no post data
}
3.For urls its probably not needed to add request baseUrl property. Example in redirect you can simply use
$this->redirect('/telephone/index');
4.Using method getLastInsertId() may lead to errors when there are some triggers in database that will create additional rows. So it may be wiser to use:
$getlast=$add->id;//assuming model autoincrement field name is "id"
can anyone help me store the values in my inputs to excel using PHPExcel? so far i have success storing data from my table to excel...now i wanna do is store the values in my inputs to the excel..can anyone help me please.
example of the form inputs: enter image description here
i want is all the data in my form will be stored in excel....my code is not working help me please.
current code:
<?php
if (!isset($_POST['send'])) { ?>
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<?php } else {
require_once 'Classes\PHPExcel\IOFactory.php';
$filename = 'file.xlsx';
$title = $_POST['title'];
mysql_connect("localhost","root","") or die ("cant connect!");
mysql_select_db("test") or die ("cant find database!");
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($filename);
$objWorksheet = $objPHPExcel->getActiveSheet();
$objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
$name1 = $_POST['name1'];
$optA1 = $_POST['optA1'];
$optB1 = $_POST['optB1'];
$optC1 = $_POST['optC1'];
$optD1 = $_POST['optD1'];
$total1 = $_POST['total1'];
$remarks1 = $_POST['remarks1'];
$name2 = $_POST['name2'];
$optA2 = $_POST['optA2'];
$optB2 = $_POST['optB2'];
$optC2 = $_POST['optC2'];
$optD2 = $_POST['optD2'];
$total2 = $_POST['total2'];
$remarks2 = $_POST['remarks2'];
$result = array(
'$name1',
'$optA1',
'$optB1',
'$optC1',
'$optD1',
'$total1',
'$remarks1'
),('$name2',
'$optA2',
'$optB2',
'$optC2',
'$optD2',
'$total2',
'$remarks2');
if(isset($_POST['send'])){
$headings = array(
'NAME',
'Gen Info. & Technical Knowledge',
'Communication Ability',
'Attitude Towards Profession',
'Appearance',
'TOTAL',
'Remarks'
);
$points = array(
' ',
'(3 pts)',
'(3 pts)',
'(2 pts)',
'(2 pts)',
'(10 pts)',
' '
);
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setAutoSize(true);
$objPHPExcel->getActiveSheet()
->getStyle('A1:I15')
->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('A1:I1')->applyFromArray(
array(
'font' => array(
'bold' => true
),
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
),
'borders' => array(
'top' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN
)
),
'fill' => array(
'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
'rotation' => 90,
'startcolor' => array(
'argb' => 'FFA0A0A0'
),
'endcolor' => array(
'argb' => 'FFFFFFFF'
)
)
)
);
$objPHPExcel->getActiveSheet()->fromArray($headings, null, 'A1');
$objPHPExcel->getActiveSheet()->fromArray($points, null, 'A2');
$row = 3;
while( $rows = mysql_fetch_row($result)){
$objPHPExcel->getActiveSheet()->fromArray($rows, null, 'A' . $row);
$row++;
}
}
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="'.$title.'.xlsx"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
}
if (!isset($_POST['send'])) { ?>
<form id="form1" name="form1" method="post" action="" >
FILE TITLE: <input name="title" type="text" id="title" />
<table>
<td><input name="name1" type="text" value="" required size="41" id="query1" /></td>
<td>
<input id="textboxid" type="radio" name="optA1" value="1" />1
<input id="textboxid" type="radio" name="optA1" value="2" />2
<input id="textboxid" type="radio" name="optA1" value="3" />3
</td>
<td>
<input id="textboxid" type="radio" name="optB1" value="1" />1
<input id="textboxid" type="radio" name="optB1" value="2" />2
<input id="textboxid" type="radio" name="optB1" value="3" />3
</td>
<td>
<input id="textboxid" type="radio" name="optC1" value="1" />1
<input id="textboxid" type="radio" name="optC1" value="2" />2
</td>
<td>
<input id="textboxid" type="radio" name="optD1" value="1" />1
<input id="textboxid" type="radio" name="optD1" value="2" />2
</td>
<td><input type="text" name="total1" size="3" /></td>
<td><input name="remarks1" type="text" value="" required size="8" /></td>
</tr>
<tr>
<td><input name="name2" type="text" value="" required size="41" id="query2" /></td>
<td>
<input id="textboxid" type="radio" name="optA2" value="1" />1
<input id="textboxid" type="radio" name="optA2" value="2" />2
<input id="textboxid" type="radio" name="optA2" value="3" />3
</td>
<td>
<input id="textboxid" type="radio" name="optB2" value="1" />1
<input id="textboxid" type="radio" name="optB2" value="2" />2
<input id="textboxid" type="radio" name="optB2" value="3" />3
</td>
<td>
<input id="textboxid" type="radio" name="optC2" value="1" />1
<input id="textboxid" type="radio" name="optC2" value="2" />2
</td>
<td>
<input id="textboxid" type="radio" name="optD2" value="1" />1
<input id="textboxid" type="radio" name="optD2" value="2" />2
</td>
<td><input type="text" name="total2" id="total2" size="3" /></td>
<td><input name="remarks2" type="text" value="" required size="8" /></td>
</tr>
</table>
<input type="submit" name="send" value="send to excel" id="send" formnovalidate />
</form>
</body>
</html>
<?php }
error:
<br />
<b>Warning</b>: mysql_fetch_row() expects parameter 1 to be resource, array given in <b>C:\xampp\htdocs\test\index.php</b> on line <b>114</b><br />
PK ܃KD%¸õºa [Content_Types].xmlÍ”]KÃ0…ïý%·Òf› "ëváôRΓ·kXš„¼Ù׿÷m»©+Žô¦¡4ç<§'ãé®2Éjgs6Ì,+Òv™³·ÅSzÇŒÂ*aœ…œíÙtr5^ì=`Bb‹9+cô÷œ£,¡˜9–¾.T"ÒkXr/äJ,ƒ[.`ck6¿?hÉ\„ø,*Âðá‘Ü }3òcÉC+¬Ù9Þ-E¤à|cÕjêŠBKPN®+’dÍuíÂO1î
`oú Ba +“µ¦Gò
±61yÜ‘{Ûy ƒçñef¤læ`©}¡û‡Në6=‹ ý,ˆ-m¥ŽÒ·.¬Þ[]ºözÌ*¡m×¢“xœGN¨Þ nNJ=YBˆúkÙ;ÙÒ8~ܵú—ÄCÛM5È›axáÚ?ýÏÌ1ú'9nþ(–"€zËÅo ïÞǼ¹À'PK ܃KD¶78é K _rels/.rels’ÍjÃ0€ï{
£{£´…1F^Ê ·2²Ðlå‡$–±½-}ûy‡±ºÒÃŽ–¥OŸ„vûyÕ;‡Ø‹Ó°.JPìŒØÞµ^ê§Õ¨˜ÈYű†3GØWw»g)åšØõ>ªqQC—’DŒ¦ã‰b!ž]þi$L”ò3´èÉÔ2nÊòÃoT¦:Z
áh· ê³ç[ØÒ4½áƒ˜·‰]ºÐyNì,Û•¹>¤>£j
-'
VÌ)‡#’÷EF^6ÚÜnô÷´8q"K‰ÐHàë>_ׄÖÿ¹¢eÆÍ<⇄áUdøvÁÅ
TŸPK ܃KDxÔÙ÷ Ó xl/_rels/workbook.xml.rels½“ÍjÃ0„ï}
±÷X¶Ó†R"çR
¹¶îim™Ø’¶?~ûª
m¦““˜;ó1BÛÝçгw±sV#‘åÀÐ*§;Û
xŸV÷À"I«eï,
1®ºÙ>c/)íDÓùÈ’‰‘à<*ƒƒŒ™óhÓMã )ÉÐr/ÕA¶ÈË<ßð0õ€êÌ“íµ€°×°zôøo×4ÂG§Þ´t!‚GûÄÏjZ$G%à—ãË%ã)íâ)ýG‡ÅÃzÑ
Œ¨_(¤ž61ÏÁÜ. óáÂ!D:ü¾QÓ1ÛÌÝ•aÊ9˜Í•aÖ¿0üì/V_PK ܃KD5‰À‰ Y docProps/app.xmlSÁnÛ0½ï+Ý9I1¬bH7ôÐb’vgN¦c¡²dˆ¬‘ôë';ˆë´Ûe:=ñ=<<’’º=4.ë0’
¾óY.2ô&”Öïñ´ûqu#2bð%¸à±G$q«¿¨M-F¶HYrðTˆš¹]II¦Æh–hŸ˜*Ä8]ã^†ª²ï‚ymг\äùW‰F_byÕŽ†âä¸êøMË`ú|ô¼;¶ÉO«omë¬NMêGkb Pqöý`Ð)9%U2Ú¢y–:WrzU[×ÉXWà•|/¨{„~f°‘´êxÕ¡á3²oij‘ýÂ>N!:ˆ<‹“ìt°k‰£þâÕˆLJŽÅNµSl¯õr$p)”c„/#î,;¤ŸÕ"ÿ%ñršxÈ &·}¾ù4ß%µø7µüÔÕ9߇DëдàÓØåˆÁÃ{투¡§vî€ñ¼—Ë¢ÚÖ±L«÷6Ô}j0º^¿®Áï±<k>ý+z>ý=_Ìòt†Çs®)ùþ)ôPK ܃KD~cJp ï docProps/core.xml}RANÃ0¼óŠÈ×*± ‚(M%#œ#B¢®Æ^ZÓĶì…ßã$mÚ Bòa×3X~ÕUô Î+£$M‰##•^/ÈÓê6¾ ‘G®%¯Œ†iÁ“eyR›ãàÁø(iŸ» D›SêÅjî“ÀÐ|3®æZ·¦–‹-_Í›ÓKŽœv‚±ÉNRŠQÒ~¸ª‚B5hô4MRzà"¸Úÿù GŽ˜µÂÖŸÔ=8²¿¼‰MÓ$ÍiO
ó§ôåþî±·+ÝE%€”…¹pÀѸò©BœCA.» +îñ>Dý¦#^µG¼ßX±36¼…òaü=ò|z}³º%e—iÌ.ãt¾bYÎX8³¾èþŸˆTëÝOÿʦg1Ëbv¾ÊÒü|žgÙŒ¥Ù½JïVPöžwe¨$xá”Å°l4¹½ÿx}86!-´qÒ—}:‡®ÛÃàem\;#?ºÉŽ–ßPK ܃KDs‘{Y³ ¦ xl/theme/theme1.xmlíYOoÛ6¿ïSº·²lÉu‚:EìØëÖ¦
·C´DK¬)Q 餾
íqÀ€aÝ°Ë€Ýv¶h]ºO“ÃÖý
{úc‹Šé6iSlCëƒ-’¿÷ŸïñQ¾|å^ÌÐ!’ò¤k9"‰Ïš„]ëÖhx¡c!©p`ÆÒµæDZW¶>¸Œ7UDb‚€<‘›¸kEJ¥›¶-}˜Æò"OIk.b¬`(B;øØÆÌn6m;Æ4±P‚càzs2¡>A£Œ¥µµ`>`ð•(™MøLø¹D"ÇS'û‘sÙgbÖµ#NÀFäž²ÃRÁB×jäËÞºl/‰˜ZC«Ñ
óOIWÓfN'Âñ’к—v–ü›ÿUÜ`0èœ%¿€},uV°î°ãô<5Pñ¸Ê»ßðn¯ñoà7z½ž·Q÷*¼»‚ï4Úîv³†w+¼·ªo»ßo×ð^…o¯à‡—6ÚnŸƒ"F“é
:‹ç22KÈ„³«FxàŨP¶¶»
úDÛk1¾ËÅ yp±¢ Ró”L°¸>ŽÇ‚âL Þ$X[)¦|¹2•ÉBÒ4U]ëãCFTO|ñô1zñôÑñý'Ç÷9~ðàøþÏ«8 uÂçßñ÷·Ÿ¢¿÷üáWf¼Ôñ¿ÿôÙo¿~i*øìëG<yôì›Ïÿü᡾-ðX‡hL$ºAŽÐ>Á6ƒ 2g£E˜Ö(pHp ¢ðÆ3®Gêλ- ˜€ÎîÖt=ˆÄLQðZ×€»œ³Fs®e²tsfIh.f:nãC“ìþ‰Ðf)ìdjbÙHMÍ=ÑÆ!IˆBÙŸb »Ciͯ»Ô\ò‰Bw(êajtɈŽ•™è*!.sluÍ7»·Q3ûrXGBB`fbIXÍâ™Â±Qc3y«È¤äÁ\ø5‡K‘ ãh)M47ż¦î5•Èö]6ëH¡èÔ„¼Ž9ב;|Úpœu¦I¤c?’SØ¢íqeT‚×3$Cp²6Ü·)QgKë[4ŒÌ$[™ SJ^ÏÇ9›`’”õ½V©cš¼¬l3
uû}Ù^À·ác§(Öëpÿýƒgɬx_¡ßWèw±B¯Ëåó¯ËU)¶õ^;g¯m¼'”±5gäºÌ‹¸ó‚!L惜hÙç§<–âj¸Pàü ®>¡*:ˆp
bœ\B(KÖ¡D)—p»°Öòί¨lÎç¼Å½ÐXíò ˜né÷Í%›|J]P+cpZaKo&Ì)€§”æxfiÞK¥Ùš7!oÎ^&8íf!6
f$Èü^0X„åÜC$#2FŽÑ§uJ·u^í5MÚFëͤ&Hº8w8ï¢ÔX‰’½šŽ,©Ðhå5=ù8íZè¹à1NŸÌJfaÒµ|UšòÊd>i°y[:µ×D¤Bª,£‚*_Z¼ŽI*ý›ž›ùá|°_W‹VÇùµ°O†–L&ÄWkfªa¹ÆgŠˆƒ(8Bc6ûôv‹ÝP GEs1¡n¹ñê™_fÁÉ×>ev`–F¸¬I-ö<^ê4õì5º¿¦)s4Å{wMÉv.4¸ ¿zA 0Êöh×âBEªPQ( qÈe^Ò"S ±ìv¦+9¬êVÁ£(ra¤öiˆ…J§"AÈž*í|3§©Ÿ¯FeYª+ÓâwL eÙÛÎì·P´¨&¥#rÜÉ Ù¦ì‡Ãÿpçã6^§=¨¹géE\èkGÁÆ›©pÆ£¶i¶¸éú¨Máš‚²/(ÜTø¬êoG|¢–%‚x¡S¦ßrr:w4ã2Vo·ªBÐi¼ýæSsvk³·ãlÏàkï家WSÔÖ.2ùhåÏ,>¾²wà~4cJïîÁ¥´¿øøØéÖ?PK ܃KD ™äÀ, K xl/sharedStrings.xmlm’ÍNÃ0„ï<…å‚uZ¤
•$UPJ"À$ÛÆ"þÁ»iéÛ×”ô¸Ÿg¼šÑÆó_Ý°xTÖ$|<Š8SÚJ™mÂ?‹Ç«Î¤©dc
$ü ÈçéYŒH,X
&¼&r3!°¬AKY&¼l¬×’Âè·Ya
#º“(š
-•á¬5꧅ܶ†Âò)OcTiLé[öúJcÑÍl†-ÍƎعÔî–PÖF•²a+c÷
T[è[r«uÛi(¤cÙ—jú¢ŒHQ[+ì^ú
Ù»·À®Ô9^šr°©XÙK~„>ü7~Yæ}t—ùS¾¾ï‡î*ž¡“eh>tˆàwÀSÖ·_\3Gx9À“Óxä«FhzrÀž%þŠp
éPK ܃KDwÀT;z É
xl/styles.xmlíVMoœ0½÷WX¾7àR5¥‘zhT5[©WkÅØÈ6ÛÝüúúƒÏMVí)í!p`æyüÞŒ±’›CËÑ”fR¤˜\Ä(eÅD“âÛüý'Œ´¡¢¢\
Hñ4¾ÉÞ%Ú9<ì ²×º£¥íhP{À:Å;cºë(ÒåZª/dÂŽÔRµÔXW5‘¶sh¥SË£MŒZÊÎÑ·yk4*e/LŠceI-ÅŒlp ²¤#{ʇ¶°µQì#lakñãOÁ'Äy¥äR!Õ)ÎóØ_´(î(g…bŒ‚ðJž¼º¼h›ã|Z–8 YÒQc#‰Ü:h°·Çæ¢÷‡èFÑ#Ù\:Úæn™d¸Q±˜³¬'z–¶b Œ4^‰3TaTA£ÀúW1v«(;ÔI͌ߣZ-Õmìn/æBŸM §æ´‡ Ñ2•)Kÿ°‹[HUÙ²ÜuŠF#Kœ¢?)6;¿{ϼÍ(Žóê”ÀùƒcøYOR.óCÂAøR¹Ú‘{ã£ióÌ#§²dÜÚË#{¨ŸS®¥^æG´ëø1—áPï¾oP¹?׋K0{Ÿ=ÇìßrÖˆM–ÐÑE;©Ø“¥w{¾Šrìz”a¥ƒ
iŒl12p0ߥ¡ã¶#¿í¶LqM¹¶MHï[™³ s‹s¨ÿ·úÉÙúK€z•òÉ™ò7Ëòɪ|òå““òÉ[ùoåÿÓò£¡.šîªåN(rßÞß»ÊlšÖ¬è7L¼Ðn-gu¨×ÿ,†öW)¨TPÓž›í¥x¶¿BÅúö
QßØ^š!ÊÛs(¾^ãOXöPK ܃KDÙ|÷5¬ xl/workbook.xmlQËn1¼÷+Ý›];¶Ñ^hÓ´úBã¤gyÅÍÑ¢ÖNòõ¥ä8Ý 9ôD‘Ž8ÃÕÙ½5b‘лFNNj)Àµ^£»mäõæâí;)()§•ñù $ÏÖoV{ï¶Þß ž_RP-÷B‚¸™‹ŽÙ§–UEmVщà¸ÓùhUâ4ÞVÄ3JS¬©¦u½¨¬B÷Ä°ŒÿÃá»[8÷í`Á¥I£K¢ÉõªC7•B…ð]YÞ÷ÞHa¥OèFÎ8õ{xQˆCø0 ÉɼžËjý¬ügì¨6=Òï§Fåxƒ°§¿øœ
Õ&ÜÁFmÉN«!ù4 â¹Jð9ú!ß'Rt)]e_
Ò¢C‹y)Ψ÷û/>â£wI™«6zcÊTn”!þž+,<aû˜ÔöW6¨‘‹š wH¸Eƒé¡‘åm «¨F2ÊŽQ¸¢º|U>áx©s\"?⥞e†ÐÓz:BÏ_EŸŽÐ§#ô¢lw\IC‡t¾q•¶ù8ÊNÓÙ|ò^–ü¬‘Ùvvx0æ#×~¸¯^_3çñZë?PK ܃KD§êçm: M xl/worksheets/sheet1.xml˜]“¢8†ï÷WPܯ~t©SÓ*BÕlÍT÷ÌÎuZ¢f ¢Nï¯ß!éݾéNÞsòæÉ! döé×1±ÎT䌧s
Û¢é–Ç,ÝÏí߃ß'¶•K’Æ$á)Ûo4·?-~›]¸xÍ”JK<äÙª`&hNÅ™ÚZLó¹}2{óíI>àMUdÇÅ‘HÕûa®Æ¸p:&C×qFÃ#aiåð þ‹ßíØ–®øöt¤©,MMˆTkÊ,ËíŬ˜á›XÌøI&,¥ß„•ŸŽG"ÞiÂ/jéöUxbûƒÔÂp1Öãb¦Ìu•,Awsû3zˆ¯SŠŒ?½ä¶%ÉË3MèVÒ¸ðÖõzáüU#%©:ç~ÙQ8ªVRœh)>ñË’'¡ª‹º.z´2.¼ôìDý;Ó%M’¹iè¿ž¨«çh¶¯`AQ3µò˜îÈ)‘jžV‹Ål[Um¾Ð3MžtQœ¶¦¨´¦&Úò$/þZG–<’_åBY,sÛL|Œ<Ûz¡¹˜¼.p{Ê%?þ,³ª5Ë·„ÞŒKK·²tkKo<;¾3ž|ØÓ«<½ÚÓÕœÎä㘸²Ä7Lw0¢)þ¸§_yúµ'r&vüaÏQå9ºy:4™à—s\yŽkÏéÀxÿ¯å°ÜOÅ.]I3Á/–(ïÊŒèG z˜ªû`«ÅÏZ-v†ò×7÷yá̆gmSe<–^#µ3–0Ãmg¬`†×ÎXÃÜÎ`†ßÎØÀŒQ;#„ãvFTfàFƤΪJÖåt;ËéÃQcøÔ('Ì#Fŗ溺:RŒ«²~?%èH1®Üæ݅׌Žë5c¨»Ž^g½æ#ûуØÆvZ6ÇiÕ[÷Ä‚žØ¦'zE(ÔŒyÝÂÂMScõÈ€ZâΉËõÄÖ=± '¶é‰…=±wî®VüÎùÍ«ôaŒ‡ÉÒ¿¿W=±uO,è‰mzb¡wEþû·Ø¨³#£jàðZSXšÂÊÖ¦˜ÂÆBSˆB‹zÜI=6©Mai
+SX›B`
SM!ß¡žtROLjSXšÂÊÖ¦˜ÂÆBSˆ&w¨§ÔS“Ú–¦°2…µ)¦°1…Тéjät¿Ò8&7P–#Ye
” ( „#‰šJ›ÿÎ+üð#À ?üð#À ?ºÇßý„\Àï~ð»€ßü.àw¿øÝ{üÝïÈüà÷ ¿ø=Àï~ð{€ß»Çßýj€0àÇ€~ø1àÇ€~øñ=þî_nä~ðû€ßü>à÷¿ø}Àï›üÃÆ×UuªÁeu¨PôçöŽ$¹ú2ã/)=¯ûù–¦D0~SÊÓ}4žœŽ©©>ñËMbiNH,ÕŽÄð-£"aéë-Ó„Jj:”jË¡<6ù·¯4nÓæ\ÜLN’,‘TÔRÆÎ\~'/ 5Ý~¤ ôSUÎKå׬8t²ö·sjp<ÓëW±Döô"öj©VBw*âÔ¯´(OeŠ¶äYÑRô…Kõ}íŠ"Ýót¹¼v*_5Ñ)³2¢Ê÷Ìþ¡Å«#Œ¦²8›ÛÕ1¾ÀDŠ#G=ôwL~çõ±PÕ¯>Ü‹ÝTNóY1Ûí¨P–_ãx}¦éíb\¹ll%5ÓO&+¾½„íSU…¨ôÅŒÇqy¦6o£šåì¥|mS5}Þìèv= ÙÙi´zH«WtêAí^³ ª[Ÿ„.þPK ܃KDÂ+ÿ ™ xl/worksheets/sheet2.xmlTÉrÛ0½÷+4¼×rÚtåLšÖMgÒI&Ks¦EÈbM* ÙM¿¾ µ:é¡'Äðhyö»2Éœ×h3q2›‹lŽJÛm&îׯ?ŠÄ“´J´‰'ðâlõjy#·ó% %L°ðµÌù°vàÁíAÐúL”Dõ"M}^B%ýk°|R «$±ë¶©ç©"SeÒ7óùû´’Úv÷?X:‡Ï˜7XjIIÜ“/uíÅj3ܸÕ2ÚÂK|SUÒ=}ƒn]ôÀÞ–€tµL‡8¥™<¨”8(2q~²87â…~b'$7w` 'P™`Mƒ\Ä]8üÖB¾ÄÃW§ÕWÃR‘k oñpæ’eág u0qä
É%öpÆ„8àWWÎXmÈ1µûÂÖQ2n\A!Cœçº^Og§"餹‚=˜Û ÉüãªÖ7ýY’Le‘º
£Ÿ‰BÏ
áæ'ã~ð}V:#Ò¾dè膦©ìs”+!myà^\lÑ\¼|ªÁq?»ñ#±´ÏZôˆ¡}ƒ+Ìw Ž«õèƆeC¸Ö†À
P÷H÷rcà9Ûƒ5/ùXÓÚiK×uàd;I< wAé89!Hná»t[n51PðÉ|öA$®}âhÖÑz'’
aÕ{eœ¶à½
:#õNÇˉš:©%Ëw§ÿ#\tš×-nY&º™
,M8Ÿóðšîq˜±ÎÔŠÊn½Ú´ë˜/Qº(À1åµR_ö`ÇÇèÖÚyšŒgzÔTòæ÷û#ÞÚ€uBt8¯½RíFñfLl6Ûì-ÜÛ<ív¸>u‚=L"”6„yÑ‚Ž½© ìÕÕ_PK ܃KDÂ+ÿ ™ xl/worksheets/sheet3.xmlTÉrÛ0½÷+4¼×rÚtåLšÖMgÒI&Ks¦EÈbM* ÙM¿¾ µ:é¡'Äðhyö»2Éœ×h3q2›‹lŽJÛm&îׯ?ŠÄ“´J´‰'ðâlõjy#·ó% %L°ðµÌù°vàÁíAÐúL”Dõ"M}^B%ýk°|R «$±ë¶©ç©"SeÒ7óùû´’Úv÷?X:‡Ï˜7XjIIÜ“/uíÅj3ܸÕ2ÚÂK|SUÒ=}ƒn]ôÀÞ–€tµL‡8¥™<¨”8(2q~²87â…~b'$7w` 'P™`Mƒ\Ä]8üÖB¾ÄÃW§ÕWÃR‘k oñpæ’eág u0qä
É%öpÆ„8àWWÎXmÈ1µûÂÖQ2n\A!Cœçº^Og§"餹‚=˜Û ÉüãªÖ7ýY’Le‘º
£Ÿ‰BÏ
áæ'ã~ð}V:#Ò¾dè膦©ìs”+!myà^\lÑ\¼|ªÁq?»ñ#±´ÏZôˆ¡}ƒ+Ìw Ž«õèƆeC¸Ö†À
P÷H÷rcà9Ûƒ5/ùXÓÚiK×uàd;I< wAé89!Hná»t[n51PðÉ|öA$®}âhÖÑz'’
aÕ{eœ¶à½
:#õNÇˉš:©%Ëw§ÿ#\tš×-nY&º™
,M8Ÿóðšîq˜±ÎÔŠÊn½Ú´ë˜/Qº(À1åµR_ö`ÇÇèÖÚyšŒgzÔTòæ÷û#ÞÚ€uBt8¯½RíFñfLl6Ûì-ÜÛ<ív¸>u‚=L"”6„yÑ‚Ž½© ìÕÕ_PK ܃KDÍKR"x # xl/worksheets/_rels/sheet1.xml.relsMŒ1! {_A¶÷#cÌq×ù £Øp+a!,1ú{)-'“™yýä¤ÞÔ$¶p˜(bW¶ÈÞÂã~ÝŸAIGÞ0&_X—Ý|£„}4b5&,Bïõ¢µ¸#e*•x˜giûÀæuE÷BOúhÌI·ÿèåPK ܃KDÍKR"x # xl/worksheets/_rels/sheet2.xml.relsMŒ1! {_A¶÷#cÌq×ù £Øp+a!,1ú{)-'“™yýä¤ÞÔ$¶p˜(bW¶ÈÞÂã~ÝŸAIGÞ0&_X—Ý|£„}4b5&,Bïõ¢µ¸#e*•x˜giûÀæuE÷BOúhÌI·ÿèåPK ܃KDÍKR"x # xl/worksheets/_rels/sheet3.xml.relsMŒ1! {_A¶÷#cÌq×ù £Øp+a!,1ú{)-'“™yýä¤ÞÔ$¶p˜(bW¶ÈÞÂã~ÝŸAIGÞ0&_X—Ý|£„}4b5&,Bïõ¢µ¸#e*•x˜giûÀæuE÷BOúhÌI·ÿèåPK ܃KD%¸õºa [Content_Types].xmlPK ܃KD¶78é K ’ _rels/.relsPK ܃KDxÔÙ÷ Ó ¤ xl/_rels/workbook.xml.relsPK ܃KD5‰À‰ Y Ó docProps/app.xmlPK ܃KD~cJp ï Š docProps/core.xmlPK ܃KDs‘{Y³ ¦ ) xl/theme/theme1.xmlPK ܃KD ™äÀ, K
xl/sharedStrings.xmlPK ܃KDwÀT;z É
k xl/styles.xmlPK ܃KDÙ|÷5¬ xl/workbook.xmlPK ܃KD§êçm: M é xl/worksheets/sheet1.xmlPK ܃KDÂ+ÿ ™ Y xl/worksheets/sheet2.xmlPK ܃KDÂ+ÿ ™ xl/worksheets/sheet3.xmlPK ܃KDÍKR"x # à xl/worksheets/_rels/sheet1.xml.relsPK ܃KDÍKR"x # | xl/worksheets/_rels/sheet2.xml.relsPK ܃KDÍKR"x # 5 xl/worksheets/_rels/sheet3.xml.relsPK ÿ î
Perhaps if you defined your array as
$result = array(
array(
$name1,
$optA1,
$optB1,
$optC1,
$optD1,
$total1,
$remarks1
),
array(
$name2,
$optA2,
$optB2,
$optC2,
$optD2,
$total2,
$remarks2
)
);
rather than as an array of string values with syntax errors
This really is basic PHP syntax, that you should be able to debug yourself
EDIT
You're also using while( $rows = mysql_fetch_row($result)){ without any database access whatsoever because you're trying to read the rows of data from the array, not from a database. Change it to:
foreach($result as $rows){
to just iterate over the array