Jump to content

samuel_lopez

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by samuel_lopez

  1. How to redirect webpage to another webpage when refreshed or reloaded
  2. Hi Ch0cu3r, I want to change my promt to a textbox popup. how can I do that? this is the current code enteredRemark = prompt('Enter your remarks', remarksField.val());
  3. File not move to target folder. foreach ($testcase as $ids => $result ) // echo $id; //echo $result; { $remarks = $_POST['remarks'][$ids]; $filename = $_POST['filename'][$ids]; $file = $_FILES['filename']['name']; $file_loc = $_FILES['filename']['tmp_name']; $file_size = $_FILES['filename']['size']; $file_type = $_FILES['filename']['type']; $folder="studentdocument/"; // new file size in KB $new_size = $file_size/1024; // new file size in KB // make file name in lower case $new_file_name = strtolower($file); // make file name in lower case $final_file=str_replace(' ','-',$new_file_name); if(move_uploaded_file($file_loc,$folder.$final_file)){ //insert statement } }
  4. Hi, I changed <td><input type="text" name="filename[<?php echo $row['student_id'] ?>]" /></td> <td><input type="file" name="filename[<?php echo $row['student_id'] ?>]" /></td> How can I save it to database? Please help. Thank you
  5. When I alert the stud_ids = name.match(/\d+/)[0]; it only show 1 for s-01, i thought that was the error?
  6. Hi Ch0cu3r, No value were passed to remarks and filename. this is my current code <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type="text/javascript"> $(function() { $('input[type=radio]').on('click', function(e) { if($(this).val() != "Passed") { // get the radio button name attribute value for the radio button that was clicked on name = $(this).attr('name'); // extract the student id from from the radio button name stud_ids = name.match(/\d+/)[0]; // target the remarks and filename textfields that are associated with the same student id remarksField = $('input[name="remarks['+stud_ids+']"]'); filenameField = $('input[name="filename['+stud_ids+']"]'); // display remark prompt and populate the prompt with the existing value enteredRemark = prompt('Enter your remarks', remarksField.val()); // display filename prompt and populate the prompt with the existing value enteredFilename = prompt('Enter your filename', filenameField.val()); // apply the values for the remarks and filename textfields remarksField.val(enteredRemark); filenameField.val(enteredFilename); } }); }); </script> <td><?php echo $row['student_id'] ?></td> <td class="tdportion1"><?php echo $row['student_id']; ?></td> <td class="tdportion1"><?php echo $row['student_name']; ?></td> <td><input type="radio" name="testcase[<?php echo $row['student_id'] ?>]" value="Passed"> Very Good </td> <td><input type="radio" name="testcase[<?php echo $row['student_id'] ?>]" value="Good" onclick="prompt"> Good </td> <td><input type="radio" name="testcase[<?php echo $row['student_id'] ?>]" value="Average" onclick="prompt"> Average </td> <td><input type="text" name="remarks[<?php echo $row['student_id'] ?>]" /></td> <td><input type="text" name="filename[<?php echo $row['student_id'] ?>]" /></td>
  7. I got an error "Uncaught TypeError: $(...) is not a function"
  8. HI Ch0cu3r, thank you for the fix but for "Very good" radio button, It should have no prompt..Please help. Thanks
  9. This is my updated function for passing on remarks textbox <script type="text/javascript"> function popup(form) { var reason = prompt("Enter remarks"); for (var i = 0; i < form.testcase.length; i++) { if(form.testcase.checked) { var full = form.testcase.name; document.getElementsByName("remarks["+ full +"]")[0].value = reason; } } } </script> but in only over write the first textbox.
  10. Hi Ch0cu3r, your suggestion is good but I have to follow my own design/process. The text boxes in the future will be hidden so that when the user clicked failed or good radio button, the user will prompt a text box to enter remarks and file. the remarks and file data will be passed to hidden text boxes for saving. Please help me. Thank you. .
  11. Hi to all,I'm newbie in using javascript,I want to ask if how can I pass pop up text value to it's assigned textbox. I used php to display data. KIndly check attached image below, Assuming I have 3 values to database and I had retrieve it. this is my form <script> function popup{ var remarks= prompt("Enter Remarks"); var remarks= prompt("Enter filename"); } </script> <form method="post"> <tr align="center"> <div class="tdportion"> <td class="tdportion1"><?php echo $row['student_id']; ?></td> <td class="tdportion1"><?php echo $row['student_name']; ?></td> </div> <td><input type="radio" name="testcase[<?php echo $row['student_id'] ?>]" value="Passed"> Very Good </td> <td><input type="radio" name="testcase[<?php echo $row['student_id'] ?>]" value="Good" onclick="popup"> Good </td> <td><input type="radio" name="testcase[<?php echo $row['student_id'] ?>]" value="Average" onclick="popup")> Average </td> <td><input type="text" name="remarks"/></td> <td><input type="text" name="filename"/></td> --></tr> <?php }; ?> <tr><td><input type="submit" name="save" value="Save all"></td></tr> </form> My process is: when radio button Good and Average is clicked, then pop up will show to enter your remarks and document. I was stuck on how to pass pop up value to its assigned textbox. Your response is much appreciated. Thank you.
  12. Hi Ch0cu3r, No value of remarks and filename are saved into the database. this is my insert query. foreach ($_POST['improvment'] as $grade_id => $status) { $remarks = $_POST['remarks'][$id]; $filename = $_POST['filename'][$id]; $sql = sprintf( "Insert into student_evaluation(student_id,improvement,Remarks,document) Values('".$grade_id ."','".$improv."','".$remarks."','".$filename."')", mysqli_real_escape_string($mysqli,$result), intval($id)); $result = mysqli_query($mysqli,$sql)or die(mysqli_error($mysqli)); }
  13. Hi Ch0cu3r, that was exactly what I want to do.Thanks. Will update you when i applied your solution. Thanks again.
  14. I used loop because I get all the students in table students table students id name s-01 peter s-02 John s-03 Doe then i will assign status(radio button),remarks(text field),document(file) in every student. .Assuming i had selected and input value for every students. <input type="radio" id="stat" name="improvement[<?php echo $row['grade_id'] ?>]" value="1"/> Very Good <input type="radio" id="stat" name="improvement[<?php echo $row['grade_id'] ?>]" value="2" /> Good <input type="radio" id="stat" name="improvement[<?php echo $row['grade_id'] ?>]" value="3"/> Average <input type="text" id = "remarks" name="remarks[<?php echo $row['grade_id'] ?>]"/>Remarks <input type="text" id = "filename" name="filename[<?php echo $row['grade_id'] ?>]"/> // Uploaded Card Like this. id name status(textfield) remarks(textfield) uploaded document(file) s-01 Peter pass excellent cards/peter.doc s-02 John failed needs improvement cards/john.doc s-03 Doe pass very good cards/doe.doc I want to save those info using only 1 button on another table name student_evaluation student_evaluation table will be like this when the button save was clicked id student id status remarks uploaded document 1 s-01 pass excellent cards/peter.doc 2 s-02 failed needs improvement cards/john.doc 3 s-03 pass very good cards/doe.doc All I want to know is how to save those data using 1 button. Please help. I was stuck with this
  15. Hi ginerjm, Thank you for the response. this is what I used to recieve input values from my html $grade_id = $_POST['improvement']; $remarks = $_POST['remarks']; $filename = $_POST['filename']; I used loop because I have multiple grades to save.
  16. Hi to all, I have a problem in inserting values into php mysql. Please help me. Thank you I have this radio buttons and textboxes: <input type="radio" id="stat" name="improvement[<?php echo $row['grade_id'] ?>]" value="1"/> Very Good <input type="radio" id="stat" name="improvement[<?php echo $row['grade_id'] ?>]" value="2" /> Good <input type="radio" id="stat" name="improvement[<?php echo $row['grade_id'] ?>]" value="3"/> Average <input type="text" id = "remarks" name="remarks[<?php echo $row['grade_id'] ?>]"/>Remarks <input type="text" id = "rem" name="filename[<?php echo $row['grade_id'] ?>]"/> // Uploaded Card this is my insert //its values id = improvement id grade_id = grade id coming from other table status = 1, 2 or 3 remarks = coming from remarks textbox filename = coming from file upload foreach ($grade_id as $grade_id => $status) { $sql = sprintf( "Insert into tblimprovements(id,grade_id,Status_ID,Remarks,Attachment) Values('".$id."','".$grade_id."','".$status.'","'.$remarks.'","'.$filename."')", mysqli_real_escape_string($mysqli,$result), intval($id)); $result = mysqli_query($mysqli,$sql)or die(mysqli_error($mysqli)); } I want to save data in my database like this/ please refer to grade.png attached ID GRADE_ID STATUS_ID, REMARKS, ATTACHMENT 1 g-01 1 Keep up the good work cards/card1.doc 2 g-02 2 Need Imporvement cards/card2.doc 3 g-03 3 Need Big Improvement cards/card3.doc 4 g-04 1 Excellent card/card4.doc My problem here is how can I insert the remarks and filename value ? Please refer to the image attached. Your response is much appreciated. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.