Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #31 (permalink)  
Old 06-08-2003, 05:13 PM
mysticmind's Avatar
Super Moderator
 
Join Date: Jun 2001
Location: Mystic Kingdoms
Posts: 2,687
Rep Power: 145
mysticmind will become famous soon enough mysticmind will become famous soon enough
Send a message via Yahoo to mysticmind
nak ngorat dia pun tak per..
dia bujang lagi tuh kot
/ saja off topic :P
__________________
Personal's Blog! - Malaysian Artist!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #32 (permalink)  
Old 07-08-2003, 08:08 AM
spicy_girl's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: aku org malaysia...
Posts: 45
Rep Power: 0
spicy_girl is on a distinguished road
ada2 jer arr mysticmind ni....

okla...ni ada soalan sket la...
kalo kiter tgk..dlm hotmail tu,dia ada satu ruang utk tick pd sbelah tepi...so,bila kiter tick,kiter blh delete, block n etc....
kalo kiter guna mysql la n php, kiter dpt buat ker camtu??
__________________
aku seadanya...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #33 (permalink)  
Old 07-08-2003, 02:32 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 97
sufyan is on a distinguished road
Lawak lah tu mysticmind...

-----

Anyway, what you're trying to do works better if you make it client-side processed. It is possible to do it with only PHP, but you would have to refresh the page, thus javascript would be better in this case because you won't need to refresh the page to check all the boxes. Below is a javascript snippet that I use a lot to achieve the 'select all' check boxes.

Within Head:
PHP Code:
<script>
function 
checkAll() {
    for (var 
i=0;i<document.userlist.elements.length;i++) {
        var 
document.userlist.elements[i];
        var 
boolValue document.userlist.selectAll.checked;
        if (
e.name != 'selectAll') {
            
e.checked boolValue; } } }
</script> 
But the following in your Body to use it.
<form name="userlist">
<input type="checkbox" name="selectAll" onclick="return checkAll();"> //this is the checkbox that checks all the checkboxes in form userlist
<input type="checkbox" name="boxname" value="1"> //put as many of these as you need

-----

For the second part of you question about the checkboxes with multiple buttons for different actions.

The simplest way to do it is just to have buttons named (for example):
<input type="button" value="Option1" name="button1" class="inputbox">
<input type="button" value="Option2" name="button2" class="inputbox">
etc...

PHP script (assuming method = POST):
[php]
if (isset($_POST['']) && ($_POST[''] == "button1") {
//Do option 1
}

if (isset($_POST['']) && ($_POST[''] == "button2") {
//Do option 2
}
[php]
And so on... that's just a basic outline on how to do it. You will need to adjust it to your needs.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #34 (permalink)  
Old 07-08-2003, 02:38 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 97
sufyan is on a distinguished road
Sorry... a few corrections...

But the following in your Body to use it. should be: Put the following in your Body to use it.

[php]
if (isset($_POST['']) && ($_POST[''] == "button1") {
//Do option 1
}

if (isset($_POST['']) && ($_POST[''] == "button2") {
//Do option 2
}
[php]

should be:

[php]
[php]
if (isset($_POST['button1']) && ($_POST['button1'] == "Option1") {
//Do option 1
}

if (isset($_POST['button2']) && ($_POST['button2'] == "Option2") {
//Do option 2
}
PHP Code:
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #35 (permalink)  
Old 27-08-2003, 09:56 AM
spicy_girl's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: aku org malaysia...
Posts: 45
Rep Power: 0
spicy_girl is on a distinguished road
saya dah dpt buat check box tu...thanks a lot...
sist. tu 70% dah siap..alhamdullilah..
thanks a lot..
cuma skarang ni....macamana saya nak modify account user...
sbb..script yg dah sedia ada tu not function properly...n still ada error..
ni scropt yg dah saya buat...

<?
// modify.php
require 'functions.php';
require 'common.inc';
global $PHP_SELF;

$selectStmt = "SELECT * FROM pesakit WHERE ROWID=$rowid";

// Connect to the Database
if (!($link = mysql_pconnect($DB_SERVER, $DB_LOGIN, $DB_PASSWORD))){
DisplayErrMsg(sprintf("internal error %d:%s\n",
mysql_errno(), mysql_error()));
exit() ;
}
function edit_record(){
$field_str = '';
$field_str .= " APPDATE = '$APPDATE', ";
$field_str .= " NAME = '$NAME', ";
$field_str .= " MRN = '$MRN', ";
$field_str .= " GP = '$GP', ";
$field_str .= " TELNUM = '$TELNUM', ";
$field_str .= " LOCATION = '$LOCATION, ";
$field_str .= " AGE = '$AGE' ,";
$field_str .= " SEX = '$SEX', ";
$field_str .= " CARDIOLOGIST = '$CARDIOLOGIST' ,";
$field_str .= " DIAGNOSIS = '$DIAGNOSIS' ,";
$field_str .= " PROSEDUR = '$PROSEDUR' ,";
$field_str .= " FINDINGS = '$FINDINGS' ,";
$field_str .= " PLANCATEGORY = '$PLANCATEGORY' ,";
$field_str .= " PLANDESCRIPTION = '$PLANDESCRIPTION' ";

$query = "UPDATE pesakit SET $field_str WHERE NAME = '$NAME'";

$result = mysql_query($query);
if(!$result) error_message(sql_error());

$num_rows = mysql_affected_rows($link_id);
if(!$num_rows) error_message("Nothing changed!");

user_message("All records regarding $NAME have been changed!");

}


function view_record(){
global $PHP_SELF;
$query="SELECT * FROM pesakit WHERE NAME='$NAME'";
$result=mysql_query($query);
if(!$result)error_message(sql_error());

$query_data=mysql_fetch_array($result);
$DATE=$query_data["DATE"];
$NAME=$query_data["NAME"];
$MRN=$query_data["MRN"];
$GP=$query_data["GP"];
$TELNUM=$query_date["TELNUM"];
$LOCATION=$query_data["LOCATION"];
$AGE=$query_data["AGE"];
$SEX=$query_data["SEX"];
$CARDIOLOGIST=$query_data["CARDIOLOGIST"];
$DIAGNOSIS=$query_data["DIAGNOSIS"];
$PROSEDUR=$query_data["PROSEDUR"];
$FINDINGS=$query_data["FINDINGS"];
$PLANCATEGORY=$query_data["PLANCATEGORY"];
$PLANDESCRIPTION=$query_data["PLANDESCRIPTION"];
?>

<html>
<title>
<head>
<body>
<center><H3>RECORD FOR <?$NAME?></H3></center>
<FORM METHOD="POST" ACTION="<?PHP ECHO $PHP_SELF?>">
<INPUT TYPE="Hidden" NAME="action" value="edit_record">
<input TYPE="HIDDEN" NAME="NAME" VALUE="<?ECHO $NAME?>">
<DIV ALIGN="CENTER"><CENTER>
<TABLE BORDER="1" WIDTH="90%" CELLPADDING="2">
<TR>
<TH WIDTH="30%" NOWRAP>NAME</TH>
<TD WIDTH="70%">
<INPUT TYPE="TEXT" NAME="NAME" VALUE="<?PHP ECHO $NAME?>" SIZE="50"></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>APPOINTMENT DATE</TH>
<TD WIDTH="70%">
<INPUT TYPE="TEXT" NAME="APPDATE" VALUE="<?PHP ECHO $APPDATE?>" SIZE="10"></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>ACCOUNT TYPE</TH>
<TD WIDTH="70%"><SELECT NAME="GP" SIZE="1">
<?php
for($i=0; $i < count($GP_array); $i++) {
if(!isset($GP) && $i == 0) {
echo "<OPTION SELECTED VALUE=\"". $GP_array[$i] . "\">" .
$GP_array[$i] . "</OPTION>\n";
}
else if($GP == $GP_array[$i]) {
echo "<OPTION SELECTED VALUE=\"". $GP_array[$i] . "\">" .
$GP_array[$i] . "</OPTION>\n";
}
else {
echo "<OPTION VALUE=\"". $GP_array[$i] . "\">" .
$GP_array[$i] . "</OPTION>\n";
}
}
?>
</SELECT></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>TEL. NUMBER</TH>
<TD WIDTH="70%">
<INPUT TYPE="TEXT" NAME="TELNUM" VALUE="<?PHP ECHO $TELNUM?>" SIZE="50"></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>LOCATION</TH>
<TD WIDTH="70%">
<INPUT TYPE="TEXT" NAME="LOCATION" VALUE="<?PHP ECHO $LOCATION?>" SIZE="50"></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>AGE</TH>
<TD WIDTH="70%">
<INPUT TYPE="TEXT" NAME="AGE" VALUE="<?PHP ECHO $AGE?>" SIZE="50"></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>SEX</TH>
<TD WIDTH="70%"><SELECT NAME="SEX" SIZE="1">
<?php
for($i=0; $i < count($SEX_array); $i++) {
if(!isset($SEX) && $i == 0) {
echo "<OPTION SELECTED VALUE=\"". $SEX_array[$i] . "\">" .
$SEX_array[$i] . "</OPTION>\n";
}
else if($SEX == $SEX_array[$i]) {
echo "<OPTION SELECTED VALUE=\"". $SEX_array[$i] . "\">" .
$SEX_array[$i] . "</OPTION>\n";
}
else {
echo "<OPTION VALUE=\"". $SEX_array[$i] . "\">" .
$SEX_array[$i] . "</OPTION>\n";
}
}
?>
</SELECT></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>CARDIOLOGIST</TH>
<TD WIDTH="70%"><SELECT NAME="CARDIOLOGIST" SIZE="1">
<?php
for($i=0; $i < count($CARDIOLOGIST_array); $i++) {
if(!isset($CARDIOLOGIST) && $i == 0) {
echo "<OPTION SELECTED VALUE=\"". $CARDIOLOGIST_array[$i] . "\">" .
$CARDIOLOGIST_array[$i] . "</OPTION>\n";
}
else if($CARDIOLOGIST == $CARDIOLOGIST_array[$i]) {
echo "<OPTION SELECTED VALUE=\"". $CARDIOLOGIST_array[$i] . "\">" .
$CARDIOLOGIST_array[$i] . "</OPTION>\n";
}
else {
echo "<OPTION VALUE=\"". $CARDIOLOGIST_array[$i] . "\">" .
$CARDIOLOGIST_array[$i] . "</OPTION>\n";
}
}
?>
</SELECT></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>DIAGNOSIS</TH>
<TD WIDTH="70%">
<TEXTAREA ROWS="5" COLS="40" NAME="DIAGNOSIS">
<?php echo htmlspecialchars($DIAGNOSIS); ?>
</TEXTAREA>
</TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>PROCEDURE</TH>
<TD WIDTH="70%">
<TEXTAREA ROWS="5" COLS="40" NAME="PROSEDUR">
<?php echo htmlspecialchars($PROSEDUR); ?>
</TEXTAREA>
</TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>FINDINGS</TH>
<TD WIDTH="70%">
<TEXTAREA ROWS="5" COLS="40" NAME="FINDINGS">
<?php echo htmlspecialchars($FINDINGS); ?>
</TEXTAREA>
</TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>PLAN CATEGORY</TH>
<TD WIDTH="70%"><SELECT NAME="PLANCATEGORY" SIZE="1">
<?php
for($i=0; $i < count($PLANCATEGORY_array); $i++) {
if(!isset($PLANCATEGORY) && $i == 0) {
echo "<OPTION SELECTED VALUE=\"". $PLANCATEGORY_array[$i] . "\">" .
$PLANCATEGORY_array[$i] . "</OPTION>\n";
}
else if($PLANCATEGORY == $PLANCATEGORY_array[$i]) {
echo "<OPTION SELECTED VALUE=\"". $PLANCATEGORY_array[$i] . "\">" .
$PLANCATEGORY_array[$i] . "</OPTION>\n";
}
else {
echo "<OPTION VALUE=\"". $PLANCATEGORY_array[$i] . "\">" .
$PLANCATEGORY_array[$i] . "</OPTION>\n";
}
}
?>
</SELECT></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>PLAN DESCRIPTION</TH>
<TD WIDTH="70%">
<TEXTAREA ROWS="5" COLS="40" NAME="PLANDESCRIPTION">
<?php echo htmlspecialchars($PLANDESCRIPTION); ?>
</TEXTAREA>
</TD>
</TR>
<TR>
<TH WIDTH="100%" COLSPAN="2" NOWRAP>
<INPUT TYPE="SUBMIT" VALUE="Change PATIENT Record">
<INPUT TYPE="RESET" VALUE="Reset">
</TH>
</TR>
</TABLE>
</CENTER></DIV>
</body>
</head>
</title>
</html>
<?
switch ($action){
case "edit_record";
edit_record();
break;
default:
view_record();
break;
}
?>

somebody can help????
__________________
aku seadanya...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #36 (permalink)  
Old 27-08-2003, 03:21 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 97
sufyan is on a distinguished road
Hi, could you please state the error(s) that you are getting.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #37 (permalink)  
Old 27-08-2003, 03:51 PM
spicy_girl's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: aku org malaysia...
Posts: 45
Rep Power: 0
spicy_girl is on a distinguished road
error yg dia listkan tu...melebihi bilangan.line yg ada la...
kalo 390...dia kata error tu kat line 391 ....
__________________
aku seadanya...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #38 (permalink)  
Old 27-08-2003, 04:00 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 97
sufyan is on a distinguished road
Line 390? The code only has 240 lines...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #39 (permalink)  
Old 27-08-2003, 04:08 PM
spicy_girl's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: aku org malaysia...
Posts: 45
Rep Power: 0
spicy_girl is on a distinguished road
390 after i added add function (after i submit that post)....
sorry...but i've changed the whole codes right now...
new problem is...
when i click certain person to modify,how can i absolutely preview their profile(not only view empty form)?
__________________
aku seadanya...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #40 (permalink)  
Old 27-08-2003, 04:15 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 97
sufyan is on a distinguished road
Deosn't your modify page (above) do that already?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #41 (permalink)  
Old 27-08-2003, 04:19 PM
spicy_girl's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: aku org malaysia...
Posts: 45
Rep Power: 0
spicy_girl is on a distinguished road
i've changed that codes(above) because when i run it,it make my pc stuck...
so,id try new script from my book...
it run properly..but..can modify with empty form...(i must fill all the fields in it)...its like add new records...
__________________
aku seadanya...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #42 (permalink)  
Old 27-08-2003, 04:24 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 97
sufyan is on a distinguished road
Oh ok...

Do something like the following:

[DB Connect]
[Select Data, Table, Record]
$TELNUM=$query_date["TELNUM"];

<INPUT TYPE="TEXT" NAME="TELNUM" VALUE="<?PHP ECHO $TELNUM?>" SIZE="50">

Note the: VALUE="<?PHP ECHO $TELNUM?>"

Just do that for all the fields in the page.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #43 (permalink)  
Old 30-08-2003, 12:20 AM
mysticmind's Avatar
Super Moderator
 
Join Date: Jun 2001
Location: Mystic Kingdoms
Posts: 2,687
Rep Power: 145
mysticmind will become famous soon enough mysticmind will become famous soon enough
Send a message via Yahoo to mysticmind
rasanya.. kalau line kurang dan error line tuh lebih dari line coding yang ada..
selalunya ada string atau quote yang tertinggal.. menjadikan dia unclose tag..
try semak betul betul.
oh ya cik rempah..
gunakan bbcode [*php] ( buang * ) tamatkan dengan [/php] lebih senang nak view kat sini rasany
__________________
Personal's Blog! - Malaysian Artist!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #44 (permalink)  
Old 30-08-2003, 10:28 AM
spicy_girl's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: aku org malaysia...
Posts: 45
Rep Power: 0
spicy_girl is on a distinguished road
ok..thanks a lot...
trimass sbb byk tlg..dlm 10% lagi,insyaallah siap la sistem ni...
__________________
aku seadanya...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #45 (permalink)  
Old 12-09-2003, 11:14 AM
spicy_girl's Avatar
Novice Webmaster
 
Join Date: Jul 2003
Location: aku org malaysia...
Posts: 45
Rep Power: 0
spicy_girl is on a distinguished road
i got 1 question...
camana nak solve ni??

Warning: Failed to connect to mailserver, verify your "SMTP" setting in php.ini in c:\phpdev\www\add.php on line 48

camana nak setting kat php.ini ?ape yg patut kite tulis kat situ utk email services?
__________________
aku seadanya...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread: