Problem in Kevin's book
Working on page 51-53. Did the examples. Did not work. When I click the link I get the source code for the second page. I changed the link from relative to
http://localhost/mysites/welcome1.ph...&lastname=Yank and this worked. this is on a mac. Why didn't the relative link work?
Which book are you referring to?
This is from Build Your Own Database Driven Website Using PHP & MySQL, 3rd Edition.
Any chance you opened the first page (containing the link) directly from your hard drive (e.g. with File->Open, or by double-clicking the file on your hard drive)? This would cause the browser to load the relative link from your hard drive as well, instead of requesting it from your web server.
By changing the link to an absolute URL, you have made sure that the linked page is being loaded from the web server, but the page containing the link is probably still being loaded directly from your hard drive.
PHP code is only processed when a file is requested through your web server, so you need to make sure you always load pages in your browser with a proper http:// URL, not a file:// URL (which loads the file directly from your hard drive).
That was it
Thanks Kevin. That did it.