HartleySan
Members-
Posts
3047 -
Joined
-
Last visited
-
Days Won
243
Everything posted by HartleySan
-
Change Another Image On Link Hover
HartleySan replied to Jane39's topic in Effortless E-Commerce with PHP and MySQL
Lemme know if I can be of any further assistance.- 15 replies
-
- javascript
- colors
-
(and 2 more)
Tagged with:
-
Yep, the problem is exactly as I thought. You are outputting HTML before the session_start function call, which you cannot do because the session_start function modifies the HTTP headers, which can't be done after content is output to the browser. The solution is to move all of your PHP logic to somewhere before any HTML is output. Make sense?
-
Change Another Image On Link Hover
HartleySan replied to Jane39's topic in Effortless E-Commerce with PHP and MySQL
$color_pallettes[$ii] is only defined because you defined it as such in your for loop. By that rationale, you can execute that same for loop any time after $color_pallettes is defined, and you've got access to the data. That answer your question?- 15 replies
-
- javascript
- colors
-
(and 2 more)
Tagged with:
-
Change Another Image On Link Hover
HartleySan replied to Jane39's topic in Effortless E-Commerce with PHP and MySQL
The only thing I can figure is that for some reason, your jQuery selector isn't matching any elements in the DOM. Otherwise, I can't imagine how the functionality wouldn't work and you wouldn't get any errors. If you want to set up a test site somewhere, I could look at the code more closely, but barring that, there's really not much else I can do to help. Sorry.- 15 replies
-
- javascript
- colors
-
(and 2 more)
Tagged with:
-
Change Another Image On Link Hover
HartleySan replied to Jane39's topic in Effortless E-Commerce with PHP and MySQL
When you say that you "still see no errors in the browser," are you viewing the console? If you had copied and pasted my code snippet into your code, then you would absolutely see something in the console, unless of course a much larger error occurred, in which case, you wouldn't see the console output because no part of the page would be output to the browser at all. If you don't know how to view the console in your browser, I definitely recommend Googling it right away. Which browser are you using?- 15 replies
-
- javascript
- colors
-
(and 2 more)
Tagged with:
-
Change Another Image On Link Hover
HartleySan replied to Jane39's topic in Effortless E-Commerce with PHP and MySQL
Your JS logic looks good from what I can tell, but I wonder if the fact you're placing the JS within the head element is causing it to not work. For the sake of debugging the issue, you can either place breakpoints within your code, and step through it line by line, or if you're not sure how to do that, you can try breaking your code up into smaller pieces (i.e., without the jQuery chaining), and console-log things out after each line to confirm the intended behavior. For example: $('.image .toggles img').hover(function () { var src = $(this).attr("data-src"); console.log(src); var $main = $(this).closest(".image").find(".main"); console.log($main); $main.attr("toggle", $main.attr("src")); console.log($main.attr("toggle")); $main.attr("src", src); console.log($main.attr("src")); }, function () { var $main = $(this).closest(".image").find(".main"); console.log($main); $main.attr("src", $main.attr("toggle")); console.log($main.attr("src")); }); Please do that and let us know what you find. Thanks.- 15 replies
-
- javascript
- colors
-
(and 2 more)
Tagged with:
-
Change Another Image On Link Hover
HartleySan replied to Jane39's topic in Effortless E-Commerce with PHP and MySQL
What errors show up in the browser console when you run the JavaScript?- 15 replies
-
- javascript
- colors
-
(and 2 more)
Tagged with:
-
Change Another Image On Link Hover
HartleySan replied to Jane39's topic in Effortless E-Commerce with PHP and MySQL
Jane, you're code is really confusing me, and I don't see any JavaScript anywhere. If you want to do this, you're going to need to use JavaScript. I would recommend storing the alternate image for each color in a data attribute of the corresponding swatches, and when a swatch is moused over, grab that data attribute and set the value as the new src attribute of the product image. That make sense?- 15 replies
-
- javascript
- colors
-
(and 2 more)
Tagged with:
-
Whether it's SQL being used to get DB data, or a file handler/parser used to get XML/JSON data, the basic steps are the same (and most of them are done for you automatically behind the scenes). Regardless of the data format though, it's always a balancing act of getting enough data up-front without getting too much, and thus slowing things down unnecessarily. Nowadays, I generally get enough data up-front to handle the page load as well as a little extra to handle common interactions; anything after that is Ajax. Of course, it's always a judgment call, and I can't tell you exactly how much to do in every scenario, but usually a bit of experimentation will get you there. Good luck!
-
Hello, and welcome to the forums, Marie. Your understanding seems correct, but if you get data from a JSON/XML file instead of the DB, you're not really saving any time/efficiency, as you're still getting data from a file, regardless of whether the format is XML, JSON or the DB. That make sense? Certainly, if there is some data you need on page load, then it makes sense to immediately get that data via PHP/MySQL and render it on the screen, without using JS/Ajax, but for anything after the initial page load, using Ajax could be beneficial. Does that answer your question?
-
Unless you want to force a page reload every time the user selects something, I would do this completely in JS. To do that, you'll want a JS array with all the industries, and then another (multi-dimensional) array/object that has all the skills for each of the industries. With that data, you can easily populate as many select elements as the user needs. I wouldn't do anything fancy beyond that. As for the other thing you asked about, when the user submits the form, I would check that everything is valid, and if it is, I would change a flag in the DB, which doesn't allow the user to move on to the site unless they have selected some job skills. I know my answer is a bit vague, but does that make sense?
-
Well, I can tell you for sure that the first time someone logs in, the $_SESSION variable is not being properly set. That's the only explanation. I would guess that the issue is in login.php, but I can't say for sure. I'd maybe temporarily remove the redirect from the login.php script, post to it, and then use the three lines of code I recommended above to check the status of the $_SESSION variable throughout the script. Hopefully, you can get it from there.