Pass variable to input
I created an html file called test.html, then navigated to it as " http://site.com/test.html?test1=a " but the textbox was left blank. Why is this?
Super simple code
<html>
<head>
<title>Test</title>
</head>
<body >
<input type=text name="test1">
</body>
</html>
source to share
The file must be a PHP file, so test.php.
Then there might be something like this:
<html>
<head>
<title>Test</title>
</head>
<body>
<input type="text" name="test1" value="<?php echo htmlspecialchars($_GET['test1'], ENT_QUOTES); ?>">
</body>
</html>
The reason it is left blank in your example is because the PHP code does not put a value in the field. It's not automatic. Also, on most servers (but not always) a .html file will not be parsed by PHP.
Also, passing it to the htmlspecialchars function will help prevent cross-site scripting .
source to share
HTML is another file extension for the web server, it won't handle any operations unless you have done something to do so. Are you expecting to open http://site.com/foo.txt?contents=helloworld and see "helloworld" in a browser?
I suggest you google some tutorials (w3schools are usually good for this kind of thing) in PHP, then on "query strings" and how server side scripting works. You should get up and running quickly with basic site scripts.
source to share