Jump to content

removal of brackets


kimjessen

Recommended Posts

Hi Yes I start a new thread, this is probably the correct one.
I have solved my problem almost. the result ends with the end of a parenthesis.
 
see picture
how do I get it deleted.
 

 

post-172690-0-01267100-1421885719_thumb.gif

<?php
$dir    = './data/test111';
$ddArray1 = scandir($dir,1);
?>
<html>
<head>
<title>Select Drop Down List</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
	
		<select name="file">
		<?php
		FOREACH($ddArray1 AS $file){
		PRINT '<option value="'.$file.'">'.$file.'</option>';
		}
		?>
		</select>


	<input type="submit"/>
	

	
</form>
</body>
</html>

<?php


if ($_POST) {
	
	echo '<pre&gt';
	print_r($_POST);
	$test='</pre&gt>';
	echo $test;
}
?>
Link to comment
https://forums.phpfreaks.com/topic/294111-removal-of-brackets/
Share on other sites

the &gt are right not a err.
yes it did make a difference, not for the better.
but a difference is something.
the result is here!

 

Array
(
[file] => test111-2015-01-22.csv
)

 

now I can almost imagine where the end brackets come from.
but how do I get them removed?
 
Moreover, many thanks for the help.
Link to comment
https://forums.phpfreaks.com/topic/294111-removal-of-brackets/#findComment-1503679
Share on other sites

Hello again!
It does not work as I expected. I would combine it with the graph, but I only get an error when I press the button.
I understand: who is in error description but can it be solved, or do I need to have the graph to run on a page by itself. ?
error message looks like this.
"
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).

Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.

For example it is a common mistake to leave a blank line before the opening "<?php". "

 

post-172690-0-89833300-1421889153_thumb.gif

<?php
$dir    = './data/test111';
$ddArray1 = scandir($dir,1);
?>
<html>
<head>
<title>Select Drop Down List</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
		<select name="file">
		<?php
		FOREACH($ddArray1 AS $file){
		PRINT '<option value="'.$file.'">'.$file.'</option>';
		}
		?>
		</select>
 	<input type="submit"/>
	</form>
</body>
</html>
 <?php
 if ($_POST) {
 $id=$_POST['file']; //only echos the 'file' index from the $_POST array
 //echo $id;
define("LOG_FILE", "./data/test111/".$id);
	require_once('jpgraph/src/jpgraph.php');
	require_once('jpgraph/src/jpgraph_line.php');
	$times = array();
	$values = array();	
	$file_lines = file(LOG_FILE, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
	foreach($file_lines as $line_num => $line_value) {
		$line_elements = explode(",", $line_value);
		$times[] = date($line_elements[0]);
		$values[] = $line_elements[1];
	}
	
	$graph = new Graph(800, 400);
	$graph->SetFrame(false);
	$graph->SetScale('intint');
	$graph->SetMarginColor('white');
	$graph->title->Set("Temp midt tank");
	
	$graph->xaxis->SetTickLabels($times);
	$graph->yaxis->scale->SetAutoMin(0);
	$graph->yaxis->title->Set("°C");
	
	$graph->ygrid->SetFill($aFlg=true, $aColor1='white', $aColor2='gray9');
	$lineplot = new LinePlot($values);
	$lineplot->SetColor('blue');
	
	$graph->Add($lineplot);
	$graph->Stroke();
	
}

 


?>
Link to comment
https://forums.phpfreaks.com/topic/294111-removal-of-brackets/#findComment-1503690
Share on other sites

No problem now we have established that works

<?php
$dir = './data/test111';
$ddArray1 = scandir($dir,1);
?>
<html>
<head>
<title>Select Drop Down List</title>
</head>
<body>
<form action="" method="get">
<select name="file">
<?php
FOREACH($ddArray1 AS $file){
PRINT '<option value="'.$file.'">'.$file.'</option>';
}
?>
</select>
<input type="submit"/>
</form>
</body>
</html>

<?php
    if (isset($_GET['file'])) {
        $id = $_GET['file'];
        echo "<img src='mygraph.php?file=$id' />" ;
    }
?>
Link to comment
https://forums.phpfreaks.com/topic/294111-removal-of-brackets/#findComment-1503711
Share on other sites

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.