Contributed by Deb Powers
<center><h1>Your background color is <? php echo $color;? >. </hl><center>
<center><h2>Your text color is <? php echo $texcolor;? >. </h2></center>
</body>
</html>
Save the file with the name snippet.php.
Upload the file to your server.
In the address bar of your web browser, type:
http://www.<yourdomain>.com/snippet.php? color=red&texcolor=white
Try it a few more times, replacing 'red' and 'white' with other colors.
The script above demonstrates one of the powerful features of PHP - the ability to dynamically define variables in your web page through the URL. The '? ' and '&' characters in the URL tell the server 'this is a php script, and these variables fit into this page'. In this case, all we did was define the background and text colors for the page BEFORE it loads. More advanced scripts combine with forms and databases to create entire dynamic pages by calling variables from the URL.
If you'd like to write your own scripts, there are a lot of great tutorials on the web to help you get started. One of the best resources is at www.webmonkey.com.
Copy and paste this code:
