Hey all,
I'm rather new to PHP but learning fast over the last several weeks, (so please pardon my ignorance)

I've created SQL db, a number of php pages & scripts which interact with it, and have created an html mainpage. The main page is going to act as a static background (wallpaper) and display results based on menu selection. My problem is this:

I want to have a menu on the left side whereby when a user slects an option, the output is displayed in the center of the page.

the php scripts function fine and display the information if I place the coding inline with the html. (I've modifid the .htaccess file). Where I'm having my difficulty is associating those scripts so they are only triggered when selected from a meu option.

I've created 2 HTML DIV-Objects on the page with absolute positining. Div-Object 1 handles the positioning of the menu, and div-object 2 is where I want the output (php script results) to display. Problem is, I'm not getting anywhere with this and could use some input.

Thanks for any and all input.

are you using complete path names?
are the file and/or directory permissions correct?
Are the PHP files in or below doc root?
I don't know what htaccess has to do with it.

All the files are in the same directory, with the exception of the includes, which are in a sub-directory, referenced by the relative path. (eg. subdir/filename) Permissions are not an issue

All the files located below the root directory, in a "development" directory while the pag is being built.

modifying htaccess allows me to imbed php files within my html page and still be active.(the html page will execute embedded php commands , specifically, 'includes')

This may be a very basic routine as far as programming goes, I'm just pulling a brainjam here, and hoping smeone can guide me in the right direction to "unjam".

a guy here saying hes just a newbie to PHP but know how to use .htaccess?

.htaccess has been around since darpanet, and terminal servers, and is a part of the server OS, not a part of the php application
php is somewhat newer

the op is just showing their age :)
( F*** mod_perl :icon_razz: )

best to post the code, its easier for someone to view it an say,"there" than for each of us to create from scratch something that may not work with the other code

i didn't say .htaccess is new... my point is .htaccess is very hard to learn... I know PHP but i have no idea on .htaccess.

back in the day
there wasnt anything else,
so you learned

This statement didn't ring true to me:

modifying htaccess allows me to imbed php files within my html page and still be active.(the html page will execute embedded php commands , specifically, 'includes')

PHP works fine embedded or otherwise, without htaccess as far as I know...
In fact ,there a bunch of good reasons to avoid htaccess altogether.
It slows the server down, is hard to use, has vulnerabilities, and it can give unexpected results if not done properly.
I don't use it.

thats why the op is asking
he knows oldschool, and wants to learn
it is easy to add server processing to html files in .htaccess, not a good idea, even the op doesnt suggest its a good idea, but it is easy and may be an good stage on the trip from static to dynamic pages, for the op coz it builds on what he already knows
without a directive in .htaccess php does not examine .htm .html files for php code

1 block at a time

Of course I could be totally wrong and the OP just wants to do it out of sheer bloody-mindedness, :D(1 below)
but I prefer not


(1) Today is bulk snowing, and I get to be inside for a half hour to eat and get warm. NOBODY can do anything to P_ me off

Member Avatar for diafol

If I get you right, are you trying to modify page content (a part of the page) when you select an option in your sidebar, without page refresh/redirect?

If so php alone won't do it - you need ajax - or just js.

Js alone can be used to hide/show different elements (but all elements are usually present in html when 'view source' is viewed) unless you load dynamic data via the server - in which case you'll need ajax.

Sorry if this isn't what you were looking for.

Yes, I am a newbie. Referring to the .htaccess, I do my diligence in researching , via the internet, the various problems I encounter. I do not care to post 'frivolous' questions, so when I ask one, it is because I've gotten truly stumped. The forums provide excellent conversations and threads on a host of issues, so usually I will find what I need in them, or elsewhere on the internet. During one such instance, I discovered the modification of this file to allow for embedding php in html. My thought was\is, if I can embed the php in the html, I could then use a cross-sampling of php and javascript to accomplish what I'm after. (Ultimately, trying to get a PHP website to communicate to a JSP website via RPC's)

My initial issue is this: I am trying to build a menuing system which is such that when an option is selected from the sidebar, the results are displayed in the main page area, as dynamically as possible. I have a "template" background\pagelayout which I want to use so I'm not 'rebuilding' the page page everytime in my coding. Some sort of refresh would work great, if I can figure that part out. The browser would still be rebuiling the page, but I wouldn't have to recode every page with the html required for the background.

Sorry for the long wait in getting back, but I've been down "in-it" and am just now coming up for air.

You are correct.
Yes, I am old(er)...*sheesh* started programming using the Zilog Z80 command set, DEC VAX systems, and basic languauge. I know HTML, XML, Javascript, and am just now learning PHP and JSP simultaneously for this project. I am NOT a programmer by trade, although I enjoy it tremendously and have done many pet projects over the years.
In this instance, I am utilizing the internet to teach myself PHP, based on xml, basic, javascript, html, logistics and fundamental programming flow. The syntax is obviously different, but the high-level-routine-flow remains the same in all languages I've encountered so far.

You are correct in php not parsing within an html page. This I learned by trial and error, hair pulling, and research. I modified the .htaccess file ONLY because I had to, after discovering it on the internet, and following the recommendations, that issue resolved nicely.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.