Jump to content
Larry Ullman's Book Forums

danconia

Members
  • Content Count

    10
  • Joined

  • Last visited

Everything posted by danconia

  1. Edit: Nevermind do not worry about this thread. Apparently my action attribute for my login form should have been "index.php?p=login". When I give correct login info, it works correctly so I just need to fix the conditional for when the login info is incorrect. Okay so I tried setting up a modular website with the standard header + left sidebar, content, and right sidebar + footer. I also want to include the ability to register / login and put up a "Home | Login" or "Home | Settings" links up at the to of the header depending on whether someone is logged in or not. Now, for some rea
  2. Found two of the problems. First of all one of my encodeURIComponent functions is misspelled encoreURIComponent, and I am missing the concatenation operator on that last encodeURIComponent.There still seems to be some other issues so I'm digging in deeper for that. JSLint / JSHint have been a help and I will utilize them in the future.
  3. So I have been writing my own code (ie not from the book) and am trying to use Ajax to do a star rating. My problems it that I keep on getting the following error: Uncaught SyntaxError: Unexpected token ( I have pointed out which line below is giving me the error but I am having problems finding out where the core of my problem is.. I have had problems before with defining functions and calling them. Why am I getting this error? I just want to call the newStarRating function at this point with the given parameters. Any help would be appreciated! For the record I realize there may
  4. Yeah I have made several changes to the PHP file and then finally tried using just the URL for the PHP script and appending the variables to the end. It seems that, among other things, my mysqli_escape_string function didn't include the first parameter ($dbc). Once I fixed this and entered in the URL it gave me back the simple "VALID" text response. <?php require_once ($_SERVER["DOCUMENT_ROOT"] . '/includes/config.inc.php'); // if (isset ($_GET['enteredUsername'])) { require_once (MYSQL); // Connect to the db. $trimmed_username = trim($_GET['enteredUsername']); $submi
  5. Thank you HartleySan, I am still digging through and it looks like the issue is probably with AJAX sending the GET request. I finally figured out how to use the developer's console in Chrome and these are the errors that I am getting: An error occurred in script '/home/kylhur/danconia.us/resources/verifyusername.php' on line 11: Undefined variable: submitted_username An error occurred in script '/home/kylhur/danconia.us/resources/verifyusername.php' on line 12: Undefined variable: dbc An error occurred in script '/home/kylhur/danconia.us/resources/verifyusername.php' on line 12: mysqli_
  6. Yeah I've started making changes according to your guys' suggestions. I've chopped out the unnecessary code a bit to try to isolate the problem but am still having issues. Unfortunately all of the tutorials that I see online use JQuery and I'm not sure I want to go through delving too deep into that right now since Ajax itself is giving me a hassle.
  7. Okay so I just finished reading the Javascript book (including Ch 11) and I am pushing forward trying to get AJAX to work on my prototype website for the first time. Specifically I want to have my registration page use AJAX to notify the user of whether their desired username is available in our system or not. I am familiar with HTML / CSS so I don't think the issue is in there, and am familiar enough with PHP and MySQL but not necessarily how PHP interacts with Javascript via AJAX. Here is my code, emphasis on the Javascript portion (and PHP portion) because those are the parts that I
  8. Okay that makes perfect sense. Thank you for connecting those two points. I am not getting an error yet because I have not implemented the code yet. I am lifting much of it to insert into my own website and have not tested the script yet. I have some experience with form handling but not file uploading so the next 1-2 weeks working on this will be fairly rocky. Thanks a ton for the help!
  9. Okay I have manually created an 'uploads' folder but what I'm trying to get at is that we don't use the move_uploaded_file function before we test if it was actually done. It's like testing that a variable was set before actually setting the variable. At what stage or line during the script does the file get uploaded to the "uploads" folder. And is that folder supposed to be the temporary or permanent folder? The lines I showed are testing a CONDITIONAL of whether or not the file was moved, right? That line (with the 'if') isn't actually moving the file. Do you at least understand
  10. I am attempting to add a feature to my website where users are able to upload images for companies, and when looking at the code for 10.3 I noticed something that confused be on line 28 & 29: if (move_uploaded_file ($_FILES['upload']['tmp_name'], "../uploads/{$_FILES['upload']['name'] }")) { echo '<p><em>The file has been uploaded!</em></p>'; What confuses me about this line is that, up until this point it does not appear that the file has actually been moved to the permanent directory. How can we expect this conditional to ever come back TRUE (since
×
×
  • Create New...