[PHP] PHP Processing Order || Function Calls

2003-03-18 Thread CF High
Hey all.

I was under the impression that PHP processes all php code first before
handing HTML processing over to the browser.

It seems that if you call an external function that, say, queries your db
for data and spits out populated formfields, the function is processed
somehow simultaneously with staright HTML. The result in this case is that
my submit button appears above the formfields! Here's a quick example:

*** global_functions.php 
?
function make_form($sql) {

dbConnect($sql); /* Runs db query */
while ($q = mysql_fetch_array($result)) { $string = input type=text
name=test value=$q[0]; }
return $string;

} ?

*** print_form.php 

? include 'global_functions.php';
$sql = SELECT first_name FROM customers LIMIT 1; ?
$display_form = make_form($sql);
?

form name=test
? echo $display_form; ?
input type=submit value=submit
/form

*** Result 

Submit button on top
Formfields are below submit button



Any info much appreciated.  I'd like to avoid having to pop the submit
button in based on the number of records returned, or other workaround.

Thanks in advance,

--Noah





--




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Processing Order || Function Calls

2003-03-18 Thread Erik Price


CF High wrote:
Hey all.

I was under the impression that PHP processes all php code first before
handing HTML processing over to the browser.
http://www.php.net/manual/en/ref.outcontrol.php



Erik

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Processing Order || Function Calls

2003-03-18 Thread CF High
Thanks for the tip Erik.

Looks like I'll need to test live on this one -- I've got a win2k/Apache/PHP
setup locally -- output buffering apparently does not work in this
configuration...

I'll look into it on our host company's Linux servers,

--Noah


Erik Price [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


 CF High wrote:
  Hey all.
 
  I was under the impression that PHP processes all php code first before
  handing HTML processing over to the browser.

 http://www.php.net/manual/en/ref.outcontrol.php



 Erik




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php