SunQuest
           PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old June 27th, 2002, 03:58 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
check box

i havecheck boxes where default values are either checked or unchecked.now, when i try to update them and save it i need to see the updated value in my form.I did this stuff with my text fields, it is working perfect.But, it is not the same with the check boxes.Any suggestions would be highly appreciated.


<?php

include "dbconnection.ini";
?>
<form name="frm_main" method="post">

<?
include "edit.ini";

?>

<br></b><input type="submit" name="save_button" value="Save"></br>
<input type="hidden" name="frm_save" value="1">
</form>



----->edit.ini<-----------

<?
if ($frm_save == 1)
{

$sql = "update Statement";
$result = ibase_query($connection, $sql);
}
$db = 'Select statement';
$query = ibase_query($connection, $db);
while ($row = ibase_fetch_object($query)) {
$test=$row[1];
}
?>


<input type="checkbox" name=field value = "<? echo $row[1]; echo $test; ?>">

Reply With Quote
  #2  
Old June 28th, 2002, 05:48 AM
Taoism Taoism is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Winnipeg, MB, Canada
Posts: 81 Taoism User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 2
RE: check box

php Code:
Original - php Code
  1.  
  2. <?php
  3.     include "dbconnection.ini";
  4.     //may want to replace below with
  5.     //if(isset($_POST['frm_save'])&&$_POST['frm_save']==1){
  6.     if($frm_save==1){
  7.         $sql="update Statement";
  8.         $result=ibase_query($connection,$sql);
  9.     }
  10.     $db='Select statement';
  11.     $query=ibase_query($connection,$db);
  12.     while($row=ibase_fetch_object($query)){$test=$row[1];}
  13.     //why are you dumping the same data twice into the value field?
  14. ?>
  15. <form name="frm_main" method="post">
  16. <input type="checkbox" name="field" value="<?php echo $test;echo$row[1]; ?>" <?php if(isset($_POST['field'])&&$_POST['field']!=''){echo 'checked';} ?>>
  17. <br></b><input type="submit" name="save_button" value="Save"></br>
  18. <input type="hidden" name="frm_save" value="1">
  19. </form>


I moved the code around a bit for my own readability...sorry..

Cheers,
Keith.

Reply With Quote
  #3  
Old June 28th, 2002, 01:36 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: check box

hi keith

when you refresh the page again, the value which is stored in the db is not reflecting.for example, if now we checked the checkbox and click save, it remains as it is checked and now, when i refresh the page, it does'nt show as it is checked.what would be the problem?would you please fix it.

thank you

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > check box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway