Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP POST and a function, Im doing something wrong
    primarykey
    data
    text
    <p>Im not sure if POST is not working or if function is not working. So heres the code for one page:</p> <pre><code>&lt;?php require_once("includes/Functions.php"); ?&gt; &lt;?php include("includes/front.php"); ?&gt; &lt;div id="register"&gt; &lt;form action="Includes/Functions.php" method="post" name="createUser"&gt; Username: &lt;input type="text" name="user" maxlength="16"/&gt;&lt;br /&gt; Password: &lt;input type="password" name="pass" maxlength="30"/&gt;&lt;br /&gt; Repeat password: &lt;input type="password"/&gt;&lt;br /&gt; E-mail: &lt;input type="email" name="mail"/&gt;&lt;br /&gt; &lt;input type="submit" value="Next" /&gt; &lt;/form&gt; &lt;a href="/login.php"&gt;Log in&lt;/a&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php include("includes/footer.php"); ?&gt; </code></pre> <p>Here is the begining of functions.php:</p> <pre><code>&lt;?php require_once("connect.php"); ?&gt; &lt;?php if(isset($_POST["createUser"]) &amp;&amp; isset($_POST["user"], $_POST["pass"], $_POST["mail"])){ call_user_func_array("createUser", array($_POST("user"), $_POST("pass"), $_POST("mail"))); } </code></pre> <p>Using echo method of troubleshooting I see that echo is working everywhere in code but not in the function I need.</p> <p>Here is the function:</p> <pre><code>function createUser ($username, $password, $email){ //Get from form $username = $_POST["user"]; $password = $_POST["pass"]; $email = $_POST["mail"]; $hashedPassword = sha1($password); //Submit to database //make query $query = ("INSERT INTO users ( username , email , hashPass ) VALUES ( '$username' , '$email' , '$hashedPassword')"); //use query if (mysql_query($query, $connection)) { //userMade.php header("Location: ../userMade.php"); exit; } else { echo "&lt;p&gt;I suck!&lt;/p&gt;"; echo "&lt;p&gt;".mysql_error()."&lt;/p&gt;"; } } </code></pre> <p>No PHP or MySQL errors are being reported, I only see a blank page.</p>
    singulars
    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.
 

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