How to include PHP code in an htmlpage |
How to include PHP code in an htmlpage |
Forca |
May 10 2017, 02:20 AM
Post
#1
|
Member Group: Members Posts: 33 Joined: 29-April 16 Member No.: 24,203 |
Hi
I have a website with a form the user has to complete in order to register. I have a PHP script running server side which sanitises the user input and adds it as a another row in a MySQL table. I have implemented various checks and balances on the user input. I would like the error messages (due to user input error/mistakes) to be displayed on a webpage with my company logo, heading, etc. I've called this my error page. Instead of creating a separate html page for each possible error message, I would like to write all the error messages into an array in PHP. The idea is then to scroll through the array (using FOREACH) and gather all array keys with non-zero data (i.e. error messages in them) into one package and write them all out one time to a html page with my company header, logo, etc. I have created the html page, but how do I get the PHP collection of error messages to display on this html error page? In other words how to write PHP code from a server side script to an existing html page? Thanks. |
Forca |
May 12 2017, 05:26 AM
Post
#2
|
Member Group: Members Posts: 33 Joined: 29-April 16 Member No.: 24,203 |
Christian, as you can see from my last post above, I was thinking along the lines of displaying the company logo and banner firstup irrespective. Then there are 3 options of text to follow below the banner:
a) User registration successful. I'll provide a button to login. b) User input error messages provided and there'll be a Registration button. c) System error notification such as failure to connect to server. Message for user to try again later or contact us if problem persists. IMHO I thought it more suitable to what my objectives but am currently stuck! Also, there should be a : after endif. |
Christian J |
May 12 2017, 07:05 AM
Post
#3
|
. Group: WDG Moderators Posts: 9,661 Joined: 10-August 06 Member No.: 7 |
I think there should be a semicolon after the endif, compare http://php.net/manual/en/control-structure...tive-syntax.php
I was thinking along the lines of displaying the company logo and banner firstup irrespective. That should work if you're not going to redirect to another URL. QUOTE Then there are 3 options of text to follow below the banner: a) User registration successful. I'll provide a button to login. Why not login the user automatically during registration? |
Lo-Fi Version | Time is now: 28th April 2024 - 12:46 PM |