javascript - Auto execute when input changes -
i started learning php , want make simple plugin wordpress. have written , set calculate $resultado
on submit. working fine want $result
auto-calculate everytime change input value can see result everytime , not have press button.
is possible javascript?
function formulario_webbudget(){ ?> <form action="" method="post"> nombre: <input type="text" maxlength="30" value="<?php echo htmlspecialchars($_post['nombre']); ?>" name="nombre" required><br> apellido: <input type="text" maxlength="40" value="<?php echo htmlspecialchars($_post['apellido']); ?>" name="apellido" required><br> correo: <input type="email" value="<?php echo htmlspecialchars($_post['correo']); ?>" name="correo" required><br> <hr> <input type="checkbox" name="check" <?php if(isset($_post['check'])) { echo "checked"; }?>> seo check<br> dominio <select name="dominio"> <option>no</option> <option <?php if ($_post['dominio'] == 'si') { echo 'selected'; } ?> value="si">si (20€)</option> </select><br> hosting <select name="hosting"> <option>no</option> <option <?php if ($_post['hosting'] == 'si') { echo 'selected'; } ?> value="si">si (50€)</option> </select><br> diseño adaptado patatin patatan <select name="diseno"> <option>no</option> <option <?php if ($_post['diseno'] == 'si') { echo 'selected'; } ?> value="si">si (200€)</option> </select><br> posisionamiento seo patatin patatan <select name="seo"> <option>no</option> <option <?php if ($_post['seo'] == 'si') { echo 'selected'; } ?> value="si">si (100€)</option> </select><br> numero de paginas patatin patatan <input type="number" name="paginas"><br> observaciones: <textarea name="observaciones" maxlength="500" placeholder="escriba sus observaciones"> <?php if(isset($_post['observaciones'])) { echo htmlentities ($_post['observaciones']); } ?> </textarea> <p><input type="submit" value="calcular"></p> </form> <?php if (isset($_post['check'])) { $valor6 = '70'; } if ($_post['dominio'] == 'si'){ $valor1 = '20'; $dominio = 'dominio blablabla'; } if ($_post['hosting'] == 'si'){ $valor2 = '50'; $hosting = 'hosting blablabla'; } if ($_post['seo'] == 'si'){ $valor3 = '100'; $seo = 'seo blablabla'; } if ($_post['diseno'] == 'si'){ $valor4 = '200'; $diseno = 'diseno blablabla'; } $valor5 = $_post['paginas'] * '50'; $resultado = $valor1 + $valor2 + $valor3 + $valor4 + $valor5 + $valor6; echo 'el presupuesto base para su web sería de ' , $resultado , '€'; ?> <?php } add_shortcode('webbudget', 'formulario_webbudget'); ?>
Comments
Post a Comment