Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 11th, 2006, 4:46 PM   #1
ASHORY
Programmer
 
ASHORY's Avatar
 
Join Date: Dec 2004
Location: Egypt
Posts: 30
Rep Power: 0 ASHORY is on a distinguished road
Send a message via ICQ to ASHORY Send a message via MSN to ASHORY Send a message via Yahoo to ASHORY
Unhappy Cant Make it With Check Boxes

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 :&nbsp;".$j."&nbsp;Not saved";
}
else{
echo "Code ID :&nbsp;".$j."&nbsp;Is saved";
}
$j++;
}
}
?>
</body>
</html>[/PHP]
__________________
"^Ahmed.SHOukRY^"
http://www.ashory.741.com
ASHORY is offline   Reply With Quote
Old Apr 11th, 2006, 4:53 PM   #2
mongeau
Newbie
 
mongeau's Avatar
 
Join Date: Apr 2006
Location: Fargo, ND
Posts: 29
Rep Power: 0 mongeau is on a distinguished road
Send a message via MSN to mongeau
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.
mongeau is offline   Reply With Quote
Old Apr 11th, 2006, 5:58 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Apr 11th, 2006, 6:28 PM   #4
mongeau
Newbie
 
mongeau's Avatar
 
Join Date: Apr 2006
Location: Fargo, ND
Posts: 29
Rep Power: 0 mongeau is on a distinguished road
Send a message via MSN to mongeau
Quote:
Originally Posted by DaWei
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.

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.
mongeau is offline   Reply With Quote
Old Apr 12th, 2006, 3:35 PM   #5
ASHORY
Programmer
 
ASHORY's Avatar
 
Join Date: Dec 2004
Location: Egypt
Posts: 30
Rep Power: 0 ASHORY is on a distinguished road
Send a message via ICQ to ASHORY Send a message via MSN to ASHORY Send a message via Yahoo to ASHORY
@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 .
__________________
"^Ahmed.SHOukRY^"
http://www.ashory.741.com
ASHORY is offline   Reply With Quote
Old Apr 12th, 2006, 3:58 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Apr 12th, 2006, 11:00 PM   #7
mongeau
Newbie
 
mongeau's Avatar
 
Join Date: Apr 2006
Location: Fargo, ND
Posts: 29
Rep Power: 0 mongeau is on a distinguished road
Send a message via MSN to mongeau
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.
mongeau is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:34 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC