javascript - Simple PHP form not working -
i´m trying make form works. i´m using codeigniter, view has form:
<form class="renuncia_form" action="/formulario/send_form" method="post"> <p> <label for="nombre">nombre y apellidos:</label> <input name="nombre" type="text" id="renuncia_nombre"> <br> <label for="participe">nº partícipe: </label> <input name="participe" type="text" id="renuncia_participe"> <br> <label for="nombre_fondo">nombre del fondo de inversión o sicav: </label> <input name="nombre_fondo" type="text" id="renuncia_fondo"> <br> <label for="email">direccion de correo electrónico: </label> <input name="email" type="text" id="renuncia_email"> <br> <input type="submit" value="enviar" class="renuncia_submit" name="enviar"> </p> </form> and controller has php:
public function send_form(){ if($_post['submit'] == "submit") { $errormessage = ""; if(empty($_post['nombre'])) { $errormessage .= "<li>you forgot enter name</li>"; } if(empty($_post['participe'])) { $errormessage .= "<li></li>"; } $varmovie = $_post['nombre']; $varname = $_post['participe']; if(empty($errormessage)) { $fs = fopen("mydata.csv","a"); fwrite($fs,$varname . ", " . $varmovie . "\n"); fclose($fs); header("location: thankyou.html"); exit; } } } i don´t know if i´m doing correctly form. want work normal form action, click on submit takes new page saying "thanks email", no ajax, that.
can me out one?
edit: put recipient e-mail?
if($_post['submit'] == "submit") should
if(isset($_post['enviar'])) as submit button not having name submit, instead name='enviar'
Comments
Post a Comment