Jump to content

how to store a variable in ob_start


rokkstar

Recommended Posts

Hello there,

 

I am passing a variable into a flash movie using php script when I come from another page.  I find the value from the querystring using:

<?php

$section = $_GET['section'];

?>

 

Everything works fine but not on the first load.  I get the following notice when I load the page without a querystring variable:

Notice: Undefined index: section in D:\sites\pc1.com\site\default.php on line 15

 

I am trying to use ob_start but am not having much luck.

<?php

ob_start();

$section=4;

?>

 

Can anyone help me out on the correct syntax here or indeed whether it is possible?

 

Many thanks

Matt

Link to comment
https://forums.phpfreaks.com/topic/47529-how-to-store-a-variable-in-ob_start/
Share on other sites

Guest prozente

Why are you wanting to use ob_start?

 

If you want to fix the warning then do something like this

 

$section = (isset($_GET['section']) ? $_GET['section'] : false);

 

If you want to get the output buffer into a variable you'd use ob_get_contents

 

http://us2.php.net/manual/en/function.ob-get-contents.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.