How to handle web surfers, who disabled JavaScript by Michael Kashirin
Article describes how to create a web page that can be viewed by users, who disabled JavaScript support or whose web browser does not support it.
Javascript and PHP Interaction
The difference between Javascript and PHP
Javascript is a client side language, meaning that it is processed by the browser not the server. PHP is a server side language, that is processed by the server and the result of the process is displayed by the browser. A typical page that includes both lnaguages will be processed in this order - a browser sends a request for a document to the server, the server will send the document to the PHP parser to process the PHP code, then sends the document to the browser which then processes the Javascript.
Transfer Values Between Pages using Javascript
(Written by: geeeet -> Visit Homepage)
With this little piece of code, it's possible to transfer values between pages, just like if you were using a serverside language, like php, jsp or asp.
HTML Code:
// This function extracts the values from the url
function getValues(){
var urlEnd = document.URL.indexOf('?');
var values = new Array();
var names;
if (urlEnd != -1){
var params = document.URL.substring(urlEnd+1, document.URL.length).split('&');
Useful Javascript - image protection
Strategy for preventing people from copying your images
A prevalent problem that plagues artists displaying their work on the Internet is unathorized copying. Someone visits your website, appreciates your artwork and with a simple click of the mouse saves a copy to their computer and possibly uses it in a manner that you never intended or places it on another webpage and claims it as their own. This is a simple Javascript function that will not allow visitors to use the familiar right mouse click to save images.
Form Validation
Validating a form
You can perform form validation before a form is submitted via JavaScript or after the form is submitted via PHP.
I've actually already demonstrated simple validation using PHP in Form Processing with PHP: Part 1, with the input.php script. After the form is submitted, the script checks to see whether a variable does or does not exist.
PHP Code:
<?php
//check if submit button clicked and the input field isn't empty, print hello
if ($submit == "click" && $UserName !=""):
echo "Hello, $UserName";