Jump to content

myitalan

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

myitalan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Would you make another attempt to help me understand where in this code the problem is.... well o.k. I know the problem is me, but I truly am lost. i see that when I make a change to the data, the script instead of replacing the data, it adds the updates to the bottom of the file. How do i stop it from adding without removing the old data. In other words update the changes i make from the txt box Thanks
  2. Thanks for the reply, but not only am i still stuck with the original question, you added another option that I have no clue... Where in my code can I change it from adding to updating? Thanks.
  3. Thanks KevinM1 O.K. I have my xml data loaded into a form where i can make txt changes and display my image. I know this is the cleanest but i'm close to getting it done at least to get my friend going, then I'll come back and do as recommend. ?> <input type="text" id="title" name="title" value="<?php echo $title ?>" > <input type="text" id="description" name="description" value="<?php echo $description ?>" ><img src="<?php echo $tmb ?>" width="100" height="80" /><?php echo "<b> <input name=\"delete\" type=\"button\" value=\"Delete Image \"> <input name=\"Update\" type=\"submit\" value=\"Update Title/Descrition \">\n</b><br>";}?> My issue now is when I hit update it just adds another record. Here is my update code: <?php error_reporting(E_ALL); ini_set( 'display_errors','1'); $images = array( 'title' => $_POST['title'], 'description' => $_POST['description'], 'tmb' => $filePath, 'tmbs' => $_POST['tmbs'], ); $doc = new DOMDocument(); $doc->load( 'photoGallery.xml' ); $doc->formatOutput = true; $r = $doc->getElementsByTagName("gallery")->item(0); $b = $doc->createElement("images"); $title = $doc->createElement("title"); $title->appendChild( $doc->createTextNode( $images["title"] ) ); $b->appendChild( $title ); $description = $doc->createElement("description"); $description->appendChild( $doc->createTextNode( $images["description"] ) ); $b->appendChild( $description ); $tmb = $doc->createElement("tmb"); $tmb->appendChild( $doc->createTextNode( $images["tmb"] ) ); $b->appendChild( $tmb ); $tmb = $doc->createElement("img"); $tmb->appendChild( $doc->createTextNode( $images["tmb"] ) ); $b->appendChild( $tmb ); $r->appendChild( $b ); $doc->save("photoGallery.xml"); // header("Location: {$_SERVER['HTTP_REFERER']}"); header("Location:adedit.php"); ?> When i try to use w+ it breaks again.
  4. Thanks for the reply, however I am in need of placing the variable $title in a text box in order to edit the text. I will be adding an update button next to the delete button. This is my post: O.K. now that I have a button after the data from the xml file echo "<b>$title - $description - $tmb <input name=\"delete\" type=\"button\" value=\" \">\n</b><br>";}?> I would like to place the variable $title in a text boxes in order to make changes. I will be adding an update button also. This is what I did and of course it broke echo "<b>?> <input name="tupdate" type="text" id="tupdate" value="<?php echo "$title"; ?>" /> - $description - $tmb <input name=\"delete\" type=\"button\" value=\" \">\n</b><br>";}?> Where am going wrong?
  5. O.K. now that I have the button that display the data from the xml file echo "<b>$title - $description - $tmb <input name=\"delete\" type=\"button\" value=\" \">\n</b><br>";}?> I would like to place the title in text boxes in order to make changes. This is what I got. Of course it broke echo "<b>?> <input name="tupdate" type="text" id="tupdate" value="<?php echo "$title"; ?>" /> - $description - $tmb <input name=\"delete\" type=\"button\" value=\" \">\n</b><br>";}?> Where am going wrong?
  6. Far from solved... I'm still trying to add a delete button or check box to the displayed xml.... My wife has probably disowned me by now I've been at this so long.
  7. Greetings, Thanks again DarkPrince2005 i did review that site... some helpful but I biggest issue is placing the php script properly in the html document. Thanks
  8. Greetings, Thank you DarkPrince2005 for your refer.. I will give it a look. KevinM1 - My apologies for the tone, it's just over the past week I'd post and someone may ask a question of me then nothing after I reply... but you are right... I do appreciate that this forum do exist and you all take time out of your lives to look at a bunch of no coders like myself. I'll keep it in check! Pikachu2000 - My posts are not repeats... there are several components to what I'm trying to do. 1. create an xml file. Done 2. create an a php script that will update that xml file uploading a picture with it. Done 3. displaying that xml file in an html page with php Done 4 updating and deleting xml records via html & php. Not Done I've been posting each step of the way and not received helpful reply so after I finally figure out one piece I've post for assistance of my next hurdle. I wouldn't reply to a post asking for loading xml into html doc when I am looking for deleting records from an xml file via php form. However Pikachu2000, if the rule is because this is one complete application that i should stay within the original post, I'd understand and would comply. Thanks to you all.
  9. Greetings, I've been at this for a complete week day and night. I just can't believe that no one is able to help me. My request can't be that difficult for professionals doing this daily. All I am asking is to have an DOM xml php script to display my xml with a pic, be able to edit title, add, delete and save. I've come close in each area but in no way can put code together to make all work. Could someone just point me in the direction of a full tutorial where I can learn how to do it. Sending me to the manual is in no way helpful for someone of my skill... It's like giving someone a Bible and say go get saved... not possible. Don't know what else to say.... I guess I've get the the message with tons of views and no reply. I promise you i won't be taking anyone's job.. just trying to get out of this bind I'm in. Would have stopped long time ago but gave someone my word. A final thanks in advance.
  10. Greetings, No... That was my error during the cut and past and retype. With the correct file called it still doesn't delete. Thanks
  11. Greetings, My apologies, the subject was for a post that i was going to send, however I figured that out and placed this post forgetting to change the subj. The First Code listing is the load form from my xml file... not posted. and the second is the delete.php file. the xml looks like this: <list> <activity>swimming</activity> <activity>running</activity> <activity>soccer</activity> </list> [code] Any help would be fine. I just want to delete the entries from the check box. ALso, I thank you for replying... if you find yourself unable to assist me any further without solving, please let me know so I could move on to a different strategy. I know you're communication with many others... I just want to finish this 4 day journey of just displaying data from man xml file and edit and deleting them. I've got the adding down.
  12. Greetings, I am trying to delete a record from my xml file. The display is correct with the delete button but it not delete. Any help. <html> <head></head> <body> <?php $xmldoc = new DOMDocument(); $xmldoc->load('gallery.xml', LIBXML_NOBLANKS); $count = 0; $activities = $xmldoc->firstChild->firstChild; //prints the list of activities, with checkboxes on the left for each item //the $count variable is the id to each entry if($activities!=null){ echo '<form name=\'erase\' action=\'delete.php\' method=\'post\'>' . "\n"; while($activities!=null){ $count++; echo " <input type=\"checkbox\" name=\"activity[]\" value=\"$count\"/>"; echo ' '.$activities->textContent.'<br/>'."\n"; $activities = $activities->nextSibling; } echo ' <input type=\'submit\' value=\'erase selected\'>'; echo '</form>'; } ?> //section used for inserting new entries. this feature is working as expected. <form name='input' action='idelete.php' method='post'> insert activity: <input type='text name='activity'/> <input type='submit' value='send'/> <br/> </form> </body> </html> delete.php <?php $xmldoc = new DOMDocument(); $xmldoc->load('sample.xml', LIBXML_NOBLANKS); $atvID = $_POST['activity']; foreach($atvID as $id){ $delnode = $xmldoc->getElementsByTagName('activity'); $xmldoc->firstChild->removeChild($delnode->item($id)); } $xmldoc->save('gallery.xml'); ?>
  13. here is s simple tutorial http://www.4guysfromrolla.com/webtech/122800-1.shtml Only thing... it's ASP. i'm not sure if I'm suppose to say that here but my fellow PHP Gurus are silent. ... just pulling your chain in hopes to get a little help. GodBless... last post if no reply
  14. Greetings, Would someone please replay and hip me to what's the deal with php forms and xml. It almost seems like TABU or something?
  15. Greetings, If you view this post, would you please point me in the direction where I can review and learn how to bring xml into a form with Php to edit the data and save back. I've tried to post my attempts but I get a ton of views but no helpful replies.. I guess this is complicated material. So to not waste your time with my mess of code please just point me to where I can learn, then maybe i can post something that make sense. That would be helpful ... a no reply is not. Thanks in advance
×
×
  • 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.