I'm looking to do something really rather simple but I'm quite new to PHP so please pardon my naivety.
My requirement is to have a simple page (here on referenced as base) which will be populated by values from another file (here on referenced as inc). The output HTML from base may look something like this:
<h2>Name: [dynamic string (e.g. Joe Bloggs) ]</h2>
<h2>Age: [dynamic value (e.g. 31) ]</h2>
<h2>Bio: [dynamic string (e.g. I was born and raised in the UK. My special features are rocket boots.)</h2>
I plan on using a URL parameter (e.g. "www.mydomain.com/base.php?id=1234") to identify the name of the inc file that will be used in a get request.
I'm not exactly sure if this is the best way to go about it, but as this is a REALLY simple project I want to avoid using mySQL or anything else to complicate matters in production.
Please can you advise:
- How should I construct the inc PHP file? Would it be best to create the variables in this as a form or array?
- How can I configure the base PHP to pull in the variables that are set in an external file
Please let me know if my logic is way off & this is completely the wrong way to go about it!
As I mentioned before, this is a very simple project so I would like to stick to raw PHP (no 3rd party tools) as I'm using this to educate myself. Thank you for any help!