Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
This may be a small question, but I haven't found any direct answer yet. Is it considered bad practice to use PHP alongside HTML? (using PHP foreach for example in combination of with HTML)
I have searched on Google and I didn't find a direct answer. Another example: What should I do when an user logs in on a website. Do I store the important information with $_SESSION (PHP) or should I store it with sessionStorage(Javascript)?
1) HTML and PHP go hand in hand, and unless you know one of the two languages you have to use them together
2) you should save the information with the $ _SESSION of php and destroy them every time a user logs-out
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 10 months ago.
This post was edited and submitted for review 10 months ago and failed to reopen the post:
Opinion-based Update the question so it can be answered with facts and citations by editing this post.
Improve this question
In sveltekit, any problem using localStorage for passing along a post id from a list to a detail or edit page instead of using $page.params.id?
Instead of having a page "edit/[id].svelte" it will just be "edit.svelte".
Should be easy to understand without showing any code. I know it has been somewhat answered e g for react and perhaps the answer is the same but I only know svelte. Similar to this question: Using localstorage in React apps instead of useContext
Pros and cons? Any risk of it being slow to setItem before getItem in edit.svelte compared to using $page.params.id?
One advantage is VS Code, having a more practical and clear file structure. The thing that started me thinking about this. Instead of a directory with edit/[id].svelte it would just be edit.svelte.
Those are two very different things, if you have edit/[id].svelte you can have server side rendering, while if you rely on localStorage you can not do that at all.
I see no benefits to doing this at all, even think you are making your code unnecessary complicated.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've got a problem. I don't know how to transfer JS variables to PHP.
In JS I've got my main script and I'm using PHP only to file management but I need some variables from JS.
The short answer is AJAX, (or SOAP but you better go with AJAX). So go do a little research on it, and if you know jQuery or Prototype or something similar, you are pretty much off for starting to code in a new technology in minutes.
Here are some links, to get you started:
How to start learning Ajax?
http://api.jquery.com/jquery.ajax/
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I would like to ask for your opinion on the topic. I can make my page refresh with both of these methods, but I do not know if they have any drawbacks. So, which one should I use?
Edit:
I'm talking about header('Refresh:0') in PHP and location.reload() in javascript.(Sorry, I forgot them first)
The draw back with doing this via JavaScript is that you are limiting this feature to users who do not have JavaScript running in their browser. If it's important that the page refresh for all users then I would suggest not doing it via JavaScript.
Doing it via PHP would run for all users, but the bigger question is why do you need to refresh the page? And could you achieve the same thing without refreshing the page?
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am developing a webbased application using javascript and I am applying a lot of algorithms on my data and a lot of processing on data is required.
I was wondering is it the common practice to do all the processing and implementing algorithms using javascript or should I do them somewhere else ( i.e. server side ) and just give the results to javascript for viewing?
Depends on what you're trying to do!
Generally if it's data crunching, you want to do that server side, and then present it to the user. Sometimes it can be helpful to offload some of this work to your client- but keep in mind, if you're pushing computing onto the client, it may cause a page to take longer to load.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Is it possible to use Javascript to query databases to display text, images and other data and, generally to perform server-side scripting? And if so would you recommend using Javascript to do this or is it better to use PHP, Python, ASP etc?
Did you hear about node.js?
Yes, it's possible.
Recommended? -It depends, as always...
It's definitely possible, see Node.js. Practical? Depends on your situation entirely.
See this question and Aziz's comment for more links.