homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

call php from web page
change from calling

 6:08 pm on Nov 12, 2011 (gmt 0)

I have a php page that reads the $_get variable and connects to database to run query and return data. If I want to move my php code to the top of the calling page instead whats the best way to pass the variable to the code? In other words instead of calling getdata.php from index.php I just want to have the php code before html and have it run from a link or button.



 2:38 pm on Nov 14, 2011 (gmt 0)

to run php code from a button you would have to submit to the server again, not sure if that is what you mean.

Your php code can be anywhere in the actual script, the top is always a good place since you probably want to use the data you get inside the page somewhere.

I don't exactly understand the series of events you want to have.


 4:55 pm on Nov 14, 2011 (gmt 0)

Some minified code would be helpful.

Can you include the second script in the first one?

// Script that connects with DB
// Pass a variable for "full page" if not an include
if (isset($_GET['full_page'])) {
// output header
//output database stuff
if (isset($_GET['full_page'])) {
// output footer

Then in index.php,



 9:47 pm on Nov 15, 2011 (gmt 0)

I'm struggling through with ajax solution. Been a long time since I did any php so it like leaning it all over.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved