i have a bit complicated problem about passing variables in php.
I have listed and nested items in html <ul>
tag and near every item i have button which should edit name of directory or file(<ul>
list are generated from existing directory tree view in server).
I managed to make a popup form to let user enter new name and i have path to the old name.
list part in index.html(which is generated):
<ul>
<li>
<p>folder</p>
<div class="edit-button">
<a href="index.php?path=!working part with getting path!></a>
</div>
<ul>
<li>
... and here subfolders etc
</li>
</ul>
</li>
</ul>
popup form part in index.html:
<div id="popupEdit" class="popupEdit">
<?php $path = $_GET['path']; ?>
<div class="popupEdit-content">
<form action="rename.php" method="post">
<input type="text" name="path" value="<?php echo $path; ?>" >
<input type="text" name="new-name" placeholder="nowa nazwa">
<input type="submit" value="Submit" class="popupEdit-submit">
</form>
</div>
</div>
first input with name path
will be hidden to pass through path of the file.
rename.php
works fine with static new name so it's just about passing new-name
into that file.
So there are two major problems here:
- when i open popup window after clicking in editing button i have refreshed page(because of
a
tag) so my popup dont last long because in default(after refresh) popup havedisplay: none
- after button is clicked for the first time i dont get
path
property intoinput
but when url of site is already filled with?path=...
part it's good and on popup for half of second(before it's reloaded) i am able to see that input with namepath
is filled with path correctly.
I think it's possible with ajax request but i have no idea how to making that possible.
I just want to edit current node name, maybe there is simplier way to do this?