xcislav
Members
-
Joined
-
Last visited
Reputation Activity
-
p.children not childNodes
childNodes will include any whitespace (left after each tag).
http://jsfiddle.net/98s7nk7x/
-
qq isn't 0, it's "0".
You'll need to parseInt v[1] to use it as an index.
qq = parseInt( v[1], 10 ); Edit: Sorry, I'm talking rubbish
-
xcislav reacted to BrowserBugs in $_POST code with login and registrationIt's a bit of a pickle here and a lot of your php is in the wrong place which will give double headers. In addition the html on the code is incorrect and although I write procedural (rather than OOP) I can't see any kind of data cleansing before inserting into the db? You might also want to look at what happens if the input field is blank, there's not conditional checks for the user and password.
Try running this in a test.php simply for creating the session.
<?php session_start(); if($_SERVER['REQUEST_METHOD']=='POST') { // If it has been posted $uname = trim($_POST['user']); $pword = trim($_POST['pass']); // Check if the fields are empty if($uname=="" || $pword=="") { $errmsg = "Please enter a username and password"; } else { $_SESSION["user"] = $uname; $_SESSION["pass"] = $pword; } } ?> <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <?php if(isset($errmsg)) { echo "<p>" . $errmsg . "</p>"; } ?> <?php if(isset($_SESSION["user"]) && isset($_SESSION["user"])) { echo "<p>Session Set for user " . $_SESSION["user"] . " and password " . $_SESSION["pass"] . "</p>"; } ?> <form action="test.php" method="post"> <ul> <li>User: <input type="text" name="user"></li> <li>Password: <input type="pass" name="pass"></li> <li><input type="submit"></li> </ul> </form> </body> </html>