webrookienomo Posted March 9, 2014 Share Posted March 9, 2014 Hi all, working on a larger project, I thought I'd copy/paste this code and try to dissect it. http://www.w3schools.com/php/showphp.asp?filename=demo_form_validation_complete I've saved to .html and .php but neither display correctly in either IE8 or Kompozer preview - I'm a rookie and not sure why the example works on my browser on my PC, but when saved to local PC, doesn't. Need someone to klonk me on the head, and open my eyes. I'm building a few registration pages that will write to a MySQL db. I have the first table created and am in the process of building the first web form page with about 11 fields, a couple are boolean and one is a bullet choice(7). I am running this on a Windows Home ver1 server with IIS6, MYSQL 5.1.36, and PHP 5.2.6 (PHPMyAdmin 4.1.10). Please, only responses about the issue and not the older environment. I know that's not the problem. Link to comment Share on other sites More sharing options...
davej Posted March 9, 2014 Share Posted March 9, 2014 I'm curious about the test... if ($_SERVER['REQUEST_METHOD'] == 'POST') { ...I wonder when this is needed? Oh, I see. This is a post-to-yourself page. So what is the problem? It doesn't look right in IE8 ? Is that a surprise? IE8 doesn't do anything right. This is a pretty simple form. What doesn't look right? To make it work in IE8 you might need to give it a HTML4.01 doctype. Replace... <!DOCTYPE HTML> ...with... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Link to comment Share on other sites More sharing options...
thescientist Posted March 10, 2014 Share Posted March 10, 2014 that doctype will work in IE8. What exactly does not working mean? Does it work in other browsers but not IE? Unless your server is configured for it, you would need to execute the file as .php. Are you sure you are running it over http on your IIS server? Are you able to see any PHP execute locally if you just do a simple <?phpecho 'Hello World';?> Please be more specific about what is actually happening as in what you are actually seeing as output / behavior. Link to comment Share on other sites More sharing options...
webrookienomo Posted March 15, 2014 Author Share Posted March 15, 2014 (edited) Thank you for the replies, for some reason, i didn't get notifications to my e-mail, so sorry for late reply. Almost immediately after I posted, I began thinking. PHP is SERVER side scripting, so saving file to PC and attempting to open wouldn't work because PHP environment is installed at the server. Boy was I asleep at the wheel on that one! So I simply copied the file over to my wwwroot folder on my WHS box and RDC to it, and open IE8 and test http://localhost/frmSimple_reg.php And it works. I also tested the simple field validation and it works as well. So now to build off of what I've learned by creating a more complex form, Add some security validation, and then figure-out how to post the data to MySQL. I have already built the first table. Edited March 15, 2014 by webrookienomo Link to comment Share on other sites More sharing options...
webrookienomo Posted March 16, 2014 Author Share Posted March 16, 2014 (edited) I've decided to firt buid a search form to lookup any records that might exist first. I've inserted a couple of test records in the table to test with. However the example adds the connection string in the body of the html an I don't want the username/password visible if a user clicks "source". so I'm trying to call the search.php file (separate). I'm using <form action="search.php" method="post">But I now have a new problem. IE attempts to open the file and I get a windows open file dialog box for the search.php which essentially is the welcome.php example with some tweaks. Edited March 16, 2014 by webrookienomo Link to comment Share on other sites More sharing options...
Ingolme Posted March 16, 2014 Share Posted March 16, 2014 That means that your server isn't executing the PHP, or it's sending the wrong Content-type header. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now