Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
foreach(glob($select)) as $filename){
echo $filename;
echo "<a class='vlightbox1' href='$filename' title='$filename'><img src='$filename' style='height:120px; width:160px; alt='$filename'></a>";
echo "<a href='ap_deleteimages.php?id=$filename'>Delete</a>";
}
It is not working Properly. I Have Added $select Value as under
$select=document.write(document.getElementById('flist').value)
and 'flist' is a option tag id in html and glob function do not work with it
foreach(glob($select) as $filename){
echo $filename;
echo "<a class='vlightbox1' href='$filename' title='$filename'><img src='$filename' style='height:120px; width:160px; alt='$filename'></a>";
echo "<a href='ap_deleteimages.php?id=$filename'>Delete</a>";
}
You have the syntax error at glob function in your code. The right syntax is in above code.
Second thing is that glob() is used to find all the search pathname matching a pattern. So you need to check that the value of $select is correct or not.
Read more above glob() function.
How about putting in the parentheses?
foreach ( glob($select) as $filename)
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to figure out how to grab the string inside H1 without actually H1 inside the string.
$html = "<div id="test"><h1>hello world</h1></div>"
foreach($html->find('div[id=test] h1') as $test1){
echo '<div>';
echo $test1;
echo '</div>';
}
$test1 returns "<h1>hello world</h1>"
I'd like for $test1 to be just "hello world" and without the h1 tags. Thank you in advance
You can use regex for this:
$str = '<div id="test"><h1>hello world</h1></div>';
$matches = array();
preg_match('/<h1>(.*)<\/h1>/', $str, $matches);
echo $matches[1];
Outputs: hello world
Docs:
http://www.php.net/preg_match
Demos:
https://eval.in/78867
http://regex101.com/r/lG3dO8
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to echo a paging function twice,
echo blaetterfunktion($seite, $wieviele_seiten);
content
echo blaetterfunktion($seite, $wieviele_seiten);
I guess that would burden the server twice?
What can I do to have the server burdened just once and still echo it twice?
Place the result of the function in a variable:
<?php
$result = blaetterfunktion($seite, $wieviele_seiten);
echo $result;
?>
content
<?php
echo $result;
?>
Save it to a variable:
<?php
$variable = blaetterfunktion($seite, $wieviele_seiten);
echo $variable;
?>
content
<?php
echo $variable;
?>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have problem with that code so please send me answer as soon as possible.
echo "<pre >";print_r($q) echo"</pre>";
Correct format to print reocrds is
echo "<pre>";
print_r($q);
echo"</pre>";
You are missing the delimiter ';' after print_r
echo "<pre >"; print_r($q); echo "</pre>";
plase add semi column (';') after print_r statement
echo "<pre >";print_r($q); echo"</pre>";
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I wrote PHP in HTML code :
<div id="loginContainer">
<?php
if(!$_SESSION['id_client']){
print "<a href=\"#\" id=\"loginButton\">";
} else {
print "<a href=\"#\" id=\"loginButton3\">";
}
?>
</a></div>
but this appears in the output page: ;}else { print
How can I get the PHP to execute?
Does your file have a .php extension (or is your server configured to process that file as PHP)?
If not, the entire block:
<?php
if(!$_SESSION['id_client'])
{
print "<a href=\"#\" id=\"loginButton\">
Is being treated as one big, ugly, invalid HTML tag, leaving the rest to be visible.
Make sure the file has a .php extension.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
The simple program is not returning the string,Please help.
<?php
function returnStr() {
return "fooBar";
}
$str=returnStr();
echo $str;
}
?>
It's a parse error:
$str=returnStr();
echo $str;
} // WHAT IS THIS BRACKET DOING HERE?
There's a fatal error tokenizing the code due the trailing/unmatched '}' remove that and the code will work. Then spend some time thinking about why you didn't know this already
There's an error in your code. The last } is useless.