Answer the question
In order to leave comments, you need to log in
How to write 0 to database in float from input value?
Good afternoon, there is a field for entering numbers
<input name="c_score" value="<?php echo $data['lists']['c_score'];?>" type="text" class="inputbox" />
<input type="button" value="Apply" onclick="javascript: document.adminForm.id.value='<?php echo $data['lists']['id']; ?>'; document.adminForm.stu_id.value='<?php echo $data['lists']['qid']; ?>'; submitbutton('quest_reportA');" />
$mainframe = JFactory::getApplication();
$database = JFactory::getDBO();
$jinput = $mainframe->input;
$c_score = $jinput->get('c_score', 0, 'INT');
......
$remark = JFactory::getApplication()->input->getRaw('remark', '');
$c_score = (float)$c_score;
$query = "UPDATE #__quiz_r_student_question SET c_score = '".$c_score."', `remark` = ".$database->Quote($remark).", reviewed = 1 WHERE c_id = '".$data['id']."'";
$database->SetQuery( $query );
$database->execute();
Answer the question
In order to leave comments, you need to log in
$c_score = $jinput->get('c_score', 0, 'STRING');
$c_score = str_replace(',', '.', $c_score);
//...
$c_score = (float)$c_score;
//$query = "UPDATE ...
Read https://cmscafe.ru/docs/joomla/developer/api/627-j...
Should help.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question