homepage Welcome to WebmasterWorld Guest from 23.20.34.25
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Visit PubCon.com
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
tw56




msg:4386263
 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.

 

jatar_k




msg:4386730
 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.

rocknbil




msg:4386790
 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?

<?php
// 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,

include('db-get-script.php');

tw56




msg:4387368
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved