Embedding PHP Code in HTML

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Barry16801
Forum Newbie
Posts: 1
Joined: Thu Oct 06, 2005 1:31 pm

Embedding PHP Code in HTML

Post by Barry16801 »

I'm new to PHP scripting and MySql. I'm working on a database now. I
purchased the "Build your own database driven website using Php &
MySql" book and it's great. But I'm trying to do something that isn't
working and I'm not sure why. I created an HTML file that is really
just a "wrapper" for my php script. In the BODY of the html file, I
just included my php scripting with the appropriate tags <?php and ?>

But it doesn't work. If I put the EXACT Same code in a separate file
and then put a button on my page that has an onsubmit of the php file,
it works. I don't want to user to have to do this. The PHP script is
running a query on the MYSQL database and creating a table dynamically
of the information in the table. I want this to happen when the page
loads.. not have the user hit a button to continue loading the page. I
can provide examples if need be.. but I'm thinking it's just something
stupid I'm doing or not doing.

Any help would be GREATLY appreciated.

Thanks
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

if when you did this it outputed the actual php tags on the browser screen, you don't have php installed/configured correctly.

if you do have it, and it reported an error, try posting the error.

in either case, post the code and we can go from there....
Post Reply