scatcatpdx Posted July 9, 2006 Share Posted July 9, 2006 I am rolling my own MYSQL shopping cart. One of my requirement is the catalog will be static html files. I have embedded the following into my web page. <form action="http://www.[my page]addcart.php" method="post" NAME="order" id="order"> Quantity: <input type=text size=2 maxlength=3 name=QUANTITY > <?php header("Location: http://www.[mypage]setInputbutton.php?item=44005"); ?> <input type=hidden name="ID_NUM" value="44005"> </form > The way it works is in the form I call SetInputbutton.php with the catalog number. The script queries database to get the quantity in stock. If good it echos the place in cart button, if below a set point it places the number in stock and a place in cart button and if zero, echo only out of stock preventign purchase. The script works but When I view HTML source; it shows the entire PHP script. The question is how to hide the PHP script for prying eyes. Quote Link to comment https://forums.phpfreaks.com/topic/14077-embedding-hidden-php-in-static-html-page/ Share on other sites More sharing options...
Daniel0 Posted July 9, 2006 Share Posted July 9, 2006 For that you'd want to use AJAX (Asynchronous JavaScript And XML). You can read about it at these links:http://www.w3schools.com/ajax/default.asp[url=http://en.wikipedia.org/wiki/Ajax_(programming)]http://en.wikipedia.org/wiki/Ajax_(programming)[/url]http://developer.mozilla.org/en/docs/AJAX:Getting_StartedYour example script won't work by the way, you are sending a header after outputting. Quote Link to comment https://forums.phpfreaks.com/topic/14077-embedding-hidden-php-in-static-html-page/#findComment-55041 Share on other sites More sharing options...
kenrbnsn Posted July 9, 2006 Share Posted July 9, 2006 Also, if your source file does not have a ".php" extension, you PHP code will not get processed and will be treated as plain text, showing up on the page and in the source.Ken Quote Link to comment https://forums.phpfreaks.com/topic/14077-embedding-hidden-php-in-static-html-page/#findComment-55044 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.