Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple PHP form not working
    primarykey
    data
    text
    <p>I´m trying to make a form that works. I´m using codeigniter, the view has this form:</p> <pre><code> &lt;form class="renuncia_form" action="/formulario/send_form" method="post"&gt; &lt;p&gt; &lt;label for="nombre"&gt;Nombre y apellidos:&lt;/label&gt; &lt;input name="nombre" type="text" id="renuncia_nombre"&gt; &lt;br&gt; &lt;label for="participe"&gt;Nº Partícipe: &lt;/label&gt; &lt;input name="participe" type="text" id="renuncia_participe"&gt; &lt;br&gt; &lt;label for="nombre_fondo"&gt;Nombre del Fondo de Inversión o SICAV: &lt;/label&gt; &lt;input name="nombre_fondo" type="text" id="renuncia_fondo"&gt; &lt;br&gt; &lt;label for="email"&gt;Direccion de correo electrónico: &lt;/label&gt; &lt;input name="email" type="text" id="renuncia_email"&gt; &lt;br&gt; &lt;input type="submit" value="Enviar" class="renuncia_submit" name="enviar"&gt; &lt;/p&gt; &lt;/form&gt; </code></pre> <p>And the controller has this php:</p> <pre><code>public function send_form(){ if($_POST['submit'] == "Submit") { $errorMessage = ""; if(empty($_POST['nombre'])) { $errorMessage .= "&lt;li&gt;You forgot to enter your name&lt;/li&gt;"; } if(empty($_POST['participe'])) { $errorMessage .= "&lt;li&gt;&lt;/li&gt;"; } $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; } } } </code></pre> <p>I don´t know if I´m doing correctly the form. I just want to work it as a normal form action, that you click on submit an it takes you to a new page saying "Thanks for your email", no AJAX, just that.</p> <p>Can anybody help me out with this one?</p> <p><strong>Edit:</strong> Also where do I put the recipient e-mail?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload