473,382 Members | 1,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

ob_flush change variable

<?php
$var01='test1';
$var02='test2';
?>

<script type="text/javascript">
-1
var a= '<?php echo $var01 ?>';
var b= '<?php echo $var02 ?>';
.... many other variables
alert(a + ' ' + b + ...);
-2
</script>
in a .php file is possible with ob_start take point 1 to point 2 but to
have an output buffer only for the alert, not also var a, var b ....
Jul 23 '08 #1
4 1594
padew wrote:
<?php
$var01='test1';
$var02='test2';
?>

<script type="text/javascript">
-1
var a= '<?php echo $var01 ?>';
var b= '<?php echo $var02 ?>';
... many other variables
alert(a + ' ' + b + ...);
-2
</script>
in a .php file is possible with ob_start take point 1 to point 2 but to
have an output buffer only for the alert, not also var a, var b ....
ob_start, etc. buffer output. I don't see any output in what you wrote.
Where are the print or echo statements to throw things into the output
buffer?
Jul 23 '08 #2
sheldonlg wrote:
padew wrote:
><?php $var01='test1'; $var02='test2';
?>

<script type="text/javascript">
-1
var a= '<?php echo $var01 ?>';
var b= '<?php echo $var02 ?>';
... many other variables alert(a + ' ' + b + ...);
-2
</script>
in a .php file is possible with ob_start take point 1 to point 2 but to
have an output buffer only for the alert, not also var a, var b ....

ob_start, etc. buffer output. I don't see any output in what you wrote.
Where are the print or echo statements to throw things into the output
buffer?
Note the close '?>' tag, so actually the whole script tag is output.

I'm not sure what the OP is trying to do but I believe they are confused
about the server-side and client-side nature of PHP and Javascript.

PHP outputs the HTML (including Javascript) to the browser where the
Javascript is 'run'. So even with buffering you've still got to output
something at the end to go to the browser.

Robin
Jul 23 '08 #3
Robin wrote:
sheldonlg wrote:
>padew wrote:
>><?php $var01='test1'; $var02='test2';
?>

<script type="text/javascript">
-1
var a= '<?php echo $var01 ?>';
var b= '<?php echo $var02 ?>';
... many other variables alert(a + ' ' + b + ...);
-2
</script>
in a .php file is possible with ob_start take point 1 to point 2 but to
have an output buffer only for the alert, not also var a, var b ....

ob_start, etc. buffer output. I don't see any output in what you
wrote. Where are the print or echo statements to throw things into
the output buffer?

Note the close '?>' tag, so actually the whole script tag is output.
I missed that.
Jul 23 '08 #4
padew wrote:
<?php
$var01='test1';
$var02='test2';
?>

<script type="text/javascript">
-1
var a= '<?php echo $var01 ?>';
var b= '<?php echo $var02 ?>';
... many other variables
alert(a + ' ' + b + ...);
-2
</script>
in a .php file is possible with ob_start take point 1 to point 2 but to
have an output buffer only for the alert, not also var a, var b ....
Sure you can output a small part of the buffer at one time and then continue
to buffer, but that won't make any sense, either it will go so fast that you
won't notice any difference or you will get a javascript that will generate an
error as it don't have the complete code when it's executed on the clientes
browser.

--

//Aho
Jul 23 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: OM | last post by:
I've found out that I can use <div id = "variable"><div> to change text and pictures on mouseovers. All I have to do is change "variable" to be the HTML text I want. I can even change the text...
3
by: Byron | last post by:
Hi, Javascript confuses me, so I usually limit myself to Dreamweaver's built-in scripts for stuff like imageswaps. But this time I'm trying to write something very simple myself. I do most of my...
1
by: Varadha | last post by:
Hi, I am declaring a variable static char Version_No = '1' in header file header.h In a application "app.exe", i am changing the value of the variable in to '2' In the same application i am...
9
by: ad | last post by:
Hi, How can I dynamically change the MasterPager of a web page?
4
by: g diddy | last post by:
Hi I have a form (Allocation_Sub_Form) which is based upon a query. This query draws information from a number of tables depending on what invigilators are invigilating particular exams. This form...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.