php - setting image as submit button in html -
at present using code follows in view image not displaying have given working.
<input type="submit" id="button" name="submit" value="generate report" src="<?php echo base_url();?>images/generatereports_btn.png" onmouseover="this.src='<?php echo base_url();?>images/generatereports_high.png'" onmouseout="this.src='<?php echo base_url();?>images/generatereports_btn.png'"/>
when using following code image displaying gave getting php error in controller , model. wrong doing , how have use in order make work me please thanks.
<input type="image" value="generate report" name="submit" id="button" src="<?php echo base_url();?>images/generatereports_btn.png" alt="submit" onmouseout="this.src='<?php echo base_url();?>images/generatereports_btn.png'" onmouseover="this.src='<?php echo base_url();?>images/generatereports_high.png'>
my controller looks
function survey_demo_response() { $data['survey_details'] = $this->session->store['survey']; if (isset($_post['submit']) && $_post['submit'] == 'generate report') { $questiondata = $_post['questions']; } if (empty($_post['questions'])) { $questiondata = 1; } $data['question'] = $this->report_model->get_response_question($questiondata); $this->load->view('reports/survey_demo_response',$data); }
the error gettin
a php error encountered severity: notice message: undefined variable: questiondata filename: admin/reports.php line number: 90 php error encountered severity: notice message: undefined offset: 0 filename: models/report_model.php line number: 1272
your $questiondata
variable doesn't initialized (first error). consequently, pass non-set varable report_model
's get_response_question()
, produces second error.
apparently, neither
isset($_post['submit']) && $_post['submit'] == 'generate report'
nor
empty($_post['questions'])
is true.
try setting $questiondata
default value before if
s.
edit, respond comments: avoid errors, do
$data['survey_details'] = $this->session->store['survey']; $questiondata="i'm fallback!"; // <---- see? if (isset($_post['submit']) && $_post['submit'] == 'generate report')
...which answers original question.
Comments
Post a Comment