adding delete button or check box to form
Posted: Mon Jul 23, 2012 12:10 am
Greetings,
I have a form that that will upload an image with comments saving to an xml file.
The page also list all the images and comments in the xml page.
What I am having trouble with is creating a delete button or check box to delete a record in the xml file via the php form.
Here is the Form:
Code:
I've tried to add this to the echo but it brakes the code.
Code:
Thank in advance.
I have a form that that will upload an image with comments saving to an xml file.
The page also list all the images and comments in the xml page.
What I am having trouble with is creating a delete button or check box to delete a record in the xml file via the php form.
Here is the Form:
Code:
Code: Select all
<form action="playlistaction.php" method="post" enctype="multipart/form-data">
<table>
<tr>
<td colspan="2"class="labelcell"><label for="title">Title:</label></td>
<td colspan="2"class="fieldcell"><input type="text" id="title" name="title" tabindex="1"/></td>
</tr>
<tr>
<td colspan="2"class="labelcell"><label for="description">Description:</label></td>
<td colspan="2"class="fieldcell"> <input type="text" id="description" name="description" tabindex="2"/><br />
</td>
<tr>
<td colspan="2"class="labelcell"><label for="userfile">Image Upload:</label></td>
<td colspan="2"> <input name="userfile" type="file" id="userfile" tabindex="2"/><br />
</td>
</tr>
<tr style="display:none">
<td colspan="2"class="labelcell"><label for="img">Image</label></td>
<td colspan="2" class="fieldcell"> <input type="text" id="img" name="img" tabindex="4"></td>
</tr>
</td>
</tr>
<td colspan="4"><input type="submit" name="upload" class="box" value="Submit" tabindex="5" /></td>
</table>
</fieldset>
</form>
<h2>Current entries:</h2>
<p>Title - Description - Image </p>
<div style="border:1px solid black; overflow:auto; height:400px; width:800px">
<?php
$doc = new DOMDocument();
$doc->load( 'photoGallery.xml' );
$gallery = $doc->getElementsByTagName( "images" );
foreach( $gallery as $images )
{
$artists = $images->getElementsByTagName( "title" );
$title = $artists->item(0)->nodeValue;
$titles= $images->getElementsByTagName( "description" );
$description= $titles->item(0)->nodeValue;
$tmbs = $images->getElementsByTagName( "tmb" );
$tmb = $tmbs->item(0)->nodeValue;
$imgs = $images->getElementsByTagName( "img" );
$img = $imgs->item(0)->nodeValue;
echo "<b>$title - $description - $tmb\n</b><br>";}?>
</div>Code:
Code: Select all
echo "<b>$title - $description - $tmb <input name="delete" type="button" value=" ">\n</b><br>";}?>
</div>