ramin
ramin

Reputation: 480

how to get variable content in div by php?

My English Languege is not good. sorry.

I Want Get My Variable Folder Name In mydiv Content and Embed to my php Code (in $flds)?

I do not want to use form.

please help me. thanks

<div id="mydiv">Variable Folder Name</div>

<?php
$flds = $mydivContent; //?????
$all_files = glob("uploads/$flds/*.*");

for ($i=0; $i<count($all_files); $i++) {
    $image_name = $all_files[$i];
    $supported_format = array('gif','jpg','jpeg','png');
    $ext = strtolower(pathinfo($image_name, PATHINFO_EXTENSION));

    if (in_array($ext, $supported_format)) {
        echo '<img  src="'.$image_name .'" alt="'.$image_name.'" />';  
    } 
    else {
        continue;
    }
}

?>

Upvotes: 0

Views: 66

Answers (1)

Ritesh Khandekar
Ritesh Khandekar

Reputation: 4005

PHP is server side programming language, PHP executes first when you send request to server there is no way to call specific html element of same page by PHP.

Either you should already put value to variable $mydivContent in PHP

or you could use html <form>(s) to get response from client

Upvotes: 2

Related Questions