Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Gilbert

  1. Thank you. I think I have it straight, but I just came up with another fly in my ointment. I can't figure what's wrong here - I get 'undefined' when I look at 'goodInput'. I have followed the w3 examples doing an xmlhttprequest specifying a callback function; usually w3 will put the responseText into a 'demo' element and assign it with innerHTML So I took it one step further and thought why can't you cut out the middleman and use a 'return' to send back the responseText and assign it to a variable. I am checking for valid input and am only going to get one response back so it seemed lo
  2. Absolutely correct - it works like a charm - Thank You very Much!! I've been a little hazy on which to use where. I know return is supposed to send back a value whereas echo sends back a string maybe with html in it. Do I have that correct? And can you add anything to that so I can get it straight in my head. Thanx again, Gil
  3. Hi all, I have a php file to check a users input and it seems pretty straight-forward as far as logic goes, but the variable seems to be concatenating the "badEntry" onto its return value. I've been over it and over it and can't seem to see what's wrong. I originally had $userInput as the only return variable, but when I started having trouble I added the $toReturn variable to hopefully make it clear what I was doing wrong. Didn't help. I enter 'sakde12345' and I get that back with 'BadEntry' concatenated to it - looks like this - sakde12345BadEntry. My callback function is supposed
  4. Thank you very much for the good help straightening out my confusions. In the questions about the ext being .php or .html I should have said my confusion was because w3 uses several examples with a lot of php intertwined with html, but now I see that they should have the .html ext and leave the php ext for purely php files. On that subject, is it normal for a website to have a lot of little php files which may be called from an xmlhttp request, or something, or could a php file have several user-defined functions and then they are called when needed? It would seem easier to remember the
  5. Hi all, I have a couple of questions that popped up while studying php; really not questions, but I want to get some confirmation that my deductions are correct from what I've figured out. I was getting very confused over the differences in the object-oriented mysqli and the procedural mysqli and translating from one to the other. I think I like using OOps better The reference list on w3 only shows the procedural syntax so I wanted to make sure I was coming up with the correct OOps. Things like 'mysqli_query($conn,$sql)' becomes '$conn->query($sql)'. I could see that quite clearly in
  6. I really thought it would be nice to save a 'keystroke' or 'tap' - if you have to do it with another click event what is the sense; they might as well click the input box. Thanx for your answer. I hope that a new method might come out to make this possible - I don't see that it is an invasion of privacy just to have your keyboard pop up when your going to do it anyway when an input box comes up.....
  7. Hi again, I would like to see if there is a way to have the phone's keyboard popup as soon as a page with a form loads. I was hoping that using autofocus might bring up the keyboard, but you still have to tap the input box to get it to show, so what's the point of autofocus. I figured if you have a certain input box with the focus you naturally would want the keyboard to show. Is there any way to have the phone's keyboard popup when you enter a page? Thanx
  8. I think I just figured it out - I searched further and the example they give in the 'jQuery AJAX' methods section gives a better example than in the "tutorial". They use a variable there and I understand how to use it now. Be careful - I've got a variable and I know how to use it!! I hope this post will help someone else if they have the same question.
  9. trying to learn .post method in jQuery - is there a way to pass a variable to the code to use in the 'data' argument of the function. The 'try it yourself' example from w3schools has the data hard-coded in, but I would like to use a variable that I got from a form, or something to do the post. I tried a few things but to no avail. Here is the code from the example: <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(
  10. Thank very much dsonesuk! You have answered and confirmed some of the hazy questions that developed in my brain while studying this.
  11. Thank you so much dsonesuk; very good explanation! I had to read a few times b/4 it all sank in. My question came out of exploring a login/signin situation. I thought I could use javascript to process the userID, which I had restricted to 8 chars. I thought I would first check to see if it was 8 chars in length, but then I realized if I wrote - ' if (uID.length == 8) ' , then someone could see that using view source and they would know enough to enter 8 chars - etc, etc. I think I understand that a userID or password or form data should be sent directly and immediately to php via a
  12. When you right click and click 'view source' in a browser, do you see ALL the code that is used for that page, including separate .css or .js files that might be in a separate folder? Or do you see only the html file and any <style> or <script> tags that are included; I imagine if you could see all the content, they would have to compile it all together somehow. Just curious - I've learner a lot from looking at the source code from many websites But it makes sense to me not to reveal ALL of your secrets online. Thanx After I posted this I was reading the w3school php tut
  13. I hope there is a simple solution to this. I want to use localStorage to remember a user, but if it's not there I want to open a form so the user can enter the info in the input box and press Submit. Then I would put that info into the localStorage for next time. I can get the form to open and display fine, but the code just continues to execute after I open the form ( display set to "block"). How can I get the code to stop and wait for the input to come in before continuing with the next line of code? I have looked at the <dialog> tag with '.showmodal' which would work I guess, b
  14. I'm baffled by this - I am trying to master for loops and I seem to have run into a snag. I looked up w3's nested for loops and got an example ( you can find it @ javascript statements and click on the 'for' link - at the bottom of the page) and it works great and I understand it . Then I tried to inject an 'if' statement to interrupt it on a condition, but I got some unexpected results and I can't see what is wrong. The logic seems correct - maybe someone can help me. The 1st listing is directly from the example and in the second listing I injected a 2 line if statement - I got the resul
  15. Hey justsomeguy, thanx for the response. I guess it was just wishful thinking - I see now that the $_SESSION vars are probably kept on the server and the js vars are put in the browser. I'm learning a lot and really appreciate all the help from all you guys!! Gil
  16. That kinda sucks. Sometimes I get busy and forget that I asked a question and then 5 or 6 days later I'll check and see a reply. Anything that can be done to get notifications whenever someone replies to your post?? Thanx, Gil
  17. I'm not sure where to post this, but I hope a mod can help me. I am not being notifies of replies to my posts. I turned on the icon for 'Notify me of replies; I have checked my profile and my email is correct; I have checked my junk email folder and they are not there. Can someone help me figure out what the problem is? Thanks, Gil
  18. Thanks for the input, Ingolme. I had just started reading about local storage and had come to the same conclusion, that it would be easier to use. I am experimenting with it now to make sure I understand the whole concept. I was learning about session vars also and I wanted to confirm that the Session variables you set with php can be used by javascript using setItem & getItem, and if they're set with js you can retrieve them with $_SESSION. I haven't started experimenting with them yet, but it appears they are the same variable, just accessed differently. Do I have that concept cor
  19. O.I.C. I got it. I have another question about cookies since I've been trying to find the best way to 'get' and 'check' them. I see some pretty complicated examples of cookies and what a program would have to do to decipher them, but if you are setting the cookies yourself, and supposedly no one else can deliver a cookie with your website, shouldn't you be able to make it as simple as you want. Of course I realize I'm dreaming about a perfect world, but is the coding & decoding of the cookies string really necessary? I've seen code where it starts with 'document.cookie' and works ju
  20. Hey justsomeguy, thanks. But I really am just starting out - can you give me a boilerplate of what the directory path would look like and to what it is referring. I'm guessing it would look like this: "www.mywebsite.com/nameofsomefolder/nameofanotherfolder/" Am I close? I was wondering how that 'path="/"' fit into the scheme of things. But if I leave out the path definition will the cookies be available to the whole site to use on whatever page and in whatever js or php I want to write? Thanx, Gil
  21. I'm just starting to use cookies for personalizing my website and I need a little clarification about the DOM. When a cookie is sent along with the request for a website, does it become available to the whole site (like every page you might load) or just to a specific page included in your website. I am planning on using the setcookie, getcookie and checkcookie functions from w3 - can I put them in any page of the website or do I have to use them from the initial page of my site? Any guidance would be appreciated.
  22. Thank you, dsonesuk and ingolme, for some reason I'm not getting alerted when replies comes in - I've even checked my spam & junk folders. Thanks for your replies - helped a lot in my understanding - I do remember seeing some code where the action reference was to the same page- I think it was $_SELF? The code is great - I used something very similar on the w3 site. It solidified it in my brain to see the thought process. Thanks a lot, Gil
  23. Hi Ingolme, I'm sorry I didn't get an alert in my email when you answered. I definitely have rows in the table that match the date - it looks just like the '2017-12-05' - and it is of type 'date' as I stated. The query returns the whole list with all dates when I run it without the WHERE clause. I was wondering if there was another syntax of 'workdate that I should be using. AHHHH! I think I just figured it out - I think I have the Joins in the wrong order because I'm trying to get the date which is in the 'Kiosks' table and I'm starting with 'Locations'. I'm going to try it and l
  24. Hi – I’m having a lot of trouble with a where clause with a date in my sql query. It seems I have tried everything and read many articles & blogs, but I can’t get it working. I understand the data type is very important to match up and the format also. Anyway I’ll tell you what I’ve got and see if anyone can help me. I’m joining 3 tables in my query – everything works fine and I get the results I want UNTIL I add the where clause. Unless there is something I need to change because of the where clause, I shouldn’t need advice on that. Tables Fields Kiosks – kioskID, w
  • Create New...