0

I am here again. I have lots of trouble but this is my main problem now.

I can successfully add dynamic rows to my html form then add it to my database. What I am doing now is, I retrieved the data, auto-populate my EDIT form. My problem is, I can't even add now to my table a row that already has 2 or 3 rows in it. What should I do? I just copy paste my code from my newform.php to editform.php. PLease help me. :(

3
  • Provide some code then only we can help you. Commented May 3, 2012 at 5:37
  • provide your code here, then only people can help you Commented May 3, 2012 at 5:40
  • provide your code so we can see whats the error Commented May 3, 2012 at 6:22

2 Answers 2

1

I think you are trying to do a CRUD(Create,Read,Update or EDIT,Delete) example using HTML/PHP.

If that is the case you can find many tutorials on googling.

Here is one which is quite good to start with. http://speckyboy.com/2011/02/17/getting-started-with-crud-in-php/

Hope it helps.Happy Coding

Sign up to request clarification or add additional context in comments.

Comments

0

I don't know what is your code but One way to achieve it.

1.create fields having name with unique id of rows from table. and a hidden field combine with all unique ids associate with a character or string like =||=.

<input type ="text" name = "naame_1" id = "name_1" value = "test" />
<input type ="text" name = "naame_5" id = "name_5" value = "test1" />
<input type="hidden" name = "allids" id = "allids" value = "1=||=5" />

And now in PHP file

 <?php
      if(isset($_POST)){
         $ids = explode("=||=" , $_POST['allids']);
          foreach($ids As $id){
             $query = "update tblename set fieldname = '".$_POST['name_'.$id]."' where id = ".$id;    
             mysql_query($query);
          }
       }
 ?>

Please try this , If this may helpful for you.

thanks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.