php - Creating a Form that autofills itself -
php - Creating a Form that autofills itself -
i'm working on "ticket" page, simple form collects info , saves record. need have select (combobox) when select something, other inputs (textfileds) auto fill or populate themselfs. simple! when select 1 alternative combobox others textfields "retrieve" info related combobox , "print" on page without reloading.
i been working php, mysql, java , i'm soooo stuck :p
the thing achieved java "pull" value of selection combobox textfield need @ to the lowest degree 2 diferent values related first option:
in database this:
solution - code - cost paint - p990 - 3.20 grind - g789 - 5.27 repair - rii8 - 89.2
so, display "labels" in combobox, related values, code , cost need auto fill textfields every time take different combobox :)
you need utilize javascript , observe when combo box changes value utilize javascript http request (get or post), php returns info requested , populate form.
ie:
<script> //using javascript $("#combobox").on("change", function(){ $.post("process.php",{sel: $(this).val()}, function(result){ $("#val1").val(result.val1); $("#val2").val(result.val2); $("#val3").val(result.val3); //... }); }); </script>
process.php if(isset($_post['sel'])) { $sel = $_post['sel']; // processing echo json_encode(array( "val1" => "some value", "val2" => "some value 2", "val3" => "some value 3", )); }
i hope helps
php mysql combobox
Comments
Post a Comment