![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
|
I was tring to make an example to check one or more Checkbox then click edit , so a new page opened to make me edit the checked areas i made a script but i couldnt find out what the problem with it ,
can any body help .. [PHP]<head> <title>Edit Code</title> </head> <body> <?php $ID = $_POST['row_id']; $ID_Count=count($ID); if (!isset($_POST['save'])) { $i=0; ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method=post> <?php while ($i < $ID_Count){ echo "Code ID :".$ID[$i]."<br />"; echo "Enter new code :"; ?> <input type="text" name="edit_<?php echo $i ; ?>"> <?php } ?> <input type=submit name=save value=Save> </form> <?php } else{ $j=0; while ($j < $ID_Count){ $Form_Code=$_POST['edit_'.$j]; $Edit_Code="UPDATE Codes SET Code='".$Form_Code."'WHERE ID='".$ID."'"; $Edit_Query=mysql_query($Edit_Code); if (!$Edit_Query){ echo "Code ID : ".$j." Not saved"; } else{ echo "Code ID : ".$j." Is saved"; } $j++; } } ?> </body> </html>[/PHP] |
|
|
|
|
|
#2 |
|
Newbie
|
Why don't you use Javascript for this? That way you won't have to sumbit the page first...
__________________
I wish I was you, so I could be friends with me. |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
One possible reason not to use script is that the client might have it disabled. Weak reason, I guess. At any rate, I don't see a sign of a checkbox in the code you show.
![]()
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 | |
|
Newbie
|
Quote:
Indeed, I think that would be a weak reason not to use JavaScript in this scenario. At the very worst, the user would have to check each checkbox manually. Serves them right for being too safety conscious... :p
__________________
I wish I was you, so I could be friends with me. |
|
|
|
|
|
|
#5 |
|
Programmer
|
@Mongeau
Iam not proffisional in Javascript but i know a little , i know php better so i need some one to help me in that page . and @Dawei the code i gave is the second page not the checkboxs page . |
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
I'm not going to review the entire thread, but if you want help with something, you need to show that something and not the panties of the girl next door.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#7 |
|
Newbie
|
Ashory, give me your first HTML page -- I will write the JavaScript for you. Trust me, it's easy to learn.
__________________
I wish I was you, so I could be friends with me. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|