Jump to content

ialsoagree

Members
  • Posts

    406
  • Joined

  • Last visited

Everything posted by ialsoagree

  1. Sorry, I forgot my "i" above for mysqli_fetch_assoc! $query = "SELECT u.profile_image FROM users AS u WHERE student_id = $current_student_profile_id"; $result_array = mysqli_fetch_assoc(msyqli_query($link_id, $query)); // You'll have to define $link_id yourself $actual_image_name = $result_array['profile_image'];
  2. $query = "SELECT u.profile_image FROM users AS u WHERE student_id = $current_student_profile_id"; $result_array = mysql_fetch_assoc(msyqli_query($link_id, $query)); // You'll have to define $link_id yourself $actual_image_name = $result_array['profile_image'];
  3. Sorry, perhaps I should have been more specific. Where is "$actual_image_name" being defined in "student_home.php"?
  4. Where is "$actual_image_name" being defined?
  5. The problem is here: document.changepassword.response.value = \"Match\"; Check out getElementById(): http://www.javascript-coder.com/javascript-form/getelementbyid-form.phtml or other methods to access the HTML DOM in javascript: http://www.quirksmode.org/dom/intro.html
  6. .josh, I mostly agree with your sentiments. I strongly agree the hybrid approach is best. My statement about preloading was really just to counter that the split second lack of style is some how a bigger inconvenience than reloading the entire page. Without it, you only have the overhead of writing the javascript along with the rest of the page on each page load. To me, that's a worthwhile thing to program for user friendliness, but that's certainly up to everyone's own opinion.
  7. I don't disagree, you obviously don't understand what the OP was asking. Allow me to explain the problem, and why javascript IS the correct solution: You have a webpage that lets the user change the way the page is displayed. There are buttons to make that change. Is it better to: A) Form a new HTTP request, have PHP requery the database, perform all it's if/thens, write a new page, and then send that to the browser. B) Have javascript update the page, and save the change to a cookie. If you don't choose B, you are doing it inefficiently. Sorry, but it's you who are doing a "hack" solution. Then your opinion and mine vary GREATLY. I cannot, under any circumstances, imagine a scenario in which it's better to create 2 HTTP requests for something that only needs 1, query the database twice for a situation that only needs 1 query, and create 2 history files in a browser (1 correct, 1 wrong) for a task that only needs 1. Mean while, my solution has no down side. Because, as I pointed out, you can still load the correct page using PHP on the first try. You are welcome to disagree with me, but please don't tell me javascript is not used to change front end content, or that using it to do so is a "hack" solution. If that's what you think, you need to learn more about javascript.
  8. Sure, except the browser has a cache, therefor defeating the need to "preload" a CSS file you've already loaded. Actually, that's entirely besides the point. Why can't your PHP file check for a cookie on it's own? Even if you do that, it's still faster to have the switch of the CSS file done by javascript. At this point, you're just nit picking, and you're not even doing a good job of it. Edit 2: Actually, now that I think about it, you could even have Javascript choose which file to load by first checking the cookie, and if there is none, loading the default. There's really a lot of solutions to this "problem."
  9. Actually no, the *very* first link talks about loading a css file: http://stackoverflow.com/questions/6806849/preload-javascript-and-css-files
  10. Seriously? Are you kidding me? http://lmgtfy.com?q=javascript preload a file
  11. Just like PHP would, yes. In fact, javascript can make that change arguably faster than PHP can once the file is cached (and it will be cached once you load it for the first time, which if that involves a switch, will favor javascript by a second or more depending on how long it would take the server to process the request using PHP).
  12. Do you mean, if there's no cookie at all? The same way PHP would: by having a default. Do you mean, how will javascript know? http://www.quirksmode.org/js/cookies.html
  13. I've already pointed out why this is wrong: Please <mod censor>. PHP is the over complication. You're trying to do a server-side change of front end content that javascript is entirely able to handle itself. By the way, if cookies are disabled, unless there's a login feature or the OP wants to save the selection via IP, there's no way to save the selection anyway.
  14. Neither. When the user makes a selection: update the HTML/CSS and save that selection in a cookie using javascript. If the user changes pages, reloads, whatever, it's saved in the cookie, you're all set. If the user wants to change back, simply update the HTML/CSS again, and save the selection in a cookie using javascript. You can do this as much as you want, no page loads, no queries to the database, no http requests (unless it has to load a css file). This is the most efficient way to solve this particular problem, it is why javascript exists.
  15. I was paraphrasing that you can change any of the HTML, including the style sheet that you've called to format the page. I would think that was intuitively obvious, but if it wasn't, I apologize for the lack of clarity.
  16. No, because I thought ahead: It helps to read the thread before commenting.
  17. You don't need to, no. But if you want to make client side changes to the layout of the page, you're going to have a tough time convincing someone who knows their stuff that JS is the wrong solution. Please, tell me what is the benefit of calling multiple database requests instead of just 1 request, in order to change the layout of the page? That's what the PHP solution is. The javascript solution is: no new pages load, no extra database queries, easier for the user. If that's the wrong solution, I'll take the wrong solution as the programmer or user any day.
  18. Agreed, doesn't help you when you want to switch between multiple desktop layouts, just like the OP stated, however: Which gets back to my original point: changing the layout of a webpage is most efficiently done using javascript, that's why it was made in the first place.
  19. You're incorrect. You need to read what the OP asked. He specifically stated he wants to offer users the ability to switch between page layouts. Without PHP (or another backend programming language) that's not even possible. Javascript can handle that at the front end, but I agree, it is not the only solution, and not the best if MargateSteve isn't familiar with Javascript. MargateSteve, your decision to use PHP is perfectly fine and will work great.
  20. Oh, I see, the problem was here, actually: $temp_path_of_uploaded_file[] = $upload_folder . $name_of_uploaded_file; This should be: $temp_path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
  21. You missed a little bit of my code when you copied. Your code is: if(!copy($tmp_name,$temp_path_of_uploaded_file))//had to leave original because $value not yet set... { $errors .= '\n error while copying the uploaded file'; } It needs to be: if(!copy($tmp_name,$temp_path_of_uploaded_file))//had to leave original because $value not yet set... { $errors .= '\n error while copying the uploaded file'; } $path_of_uploaded_file[] = $temp_path_of_uploaded_file; You're missing $path_of_uploaded_file[] = $temp_path_of_uploaded_file;.
  22. Your radio buttons need to have a value: <input type="radio" name="radioButtonName" value="someValue" /> someValue <input type="radio" name="radioButtonName" value="someOtherValue" /> someOtherValue Which value is selected will be stored in $_POST['radioButtonName'] in this case.
  23. Can you copy your current code again?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.