RE: [PHP-DB] Re: Display Mysql Result in drop down list

2003-12-25 Thread irinchiang
Hi:

Well, when i bring out the page with the drop down list it was able to display 
all tutors' names from "tutor_name" column. Anyway here's a review of my code
(snip) again before i continue:
---

$sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day,   
timetable_time)
VALUES
('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time')";





" .$row
["tutor_name"]. "";
 }
 $result = $db->query($sql);

?>






---

so when i submit the form, i am suppose to echo the values i have entered into 
the field and then INSERT the values into DB (Queries stated above). However i 
was able to echo all other values eg. class_code, edu_level, etc...but 
not "tutor_name"same thing happen when i do an INSERT, all other values 
are inserted into DB but not $tutor_namewhy is this so???Really need some 
help here...Anyway i have already specify a name to be reference :



and then I also did an echo of "tutor_name" being selected:

while($selected_tutor_name == $tutor_name)
echo $_POST["tutor_name"];

All help are greatly appreciated =)

Irin.

---
On Tue, 23 Dec 2003 16:00:04 -0500, "Aleks @ USA.net" <[EMAIL PROTECTED]> wrote:
---
Hi, 

I am looking at your code and have a question, in your code you have 

print "" .$row ["tutor_name"]. 
""; 

Doesn't the SELECTED piece mark everything listed as selected?? When you 
bring up the page with the drop down list and open the source, what does it 
show?? 

I handle this  a little differently, I create my drop down list as follows: 

=== Code used  

// First I retrieve all customer information 

$BB = mysql_query("SELECT * FROM customer ORDER BY CID "); 



// Then I create the drop down list 

 


$Sname     $SCity 
    $SState     $SCountry \n");   

  } 
  
?> 

 

=== Code used  

This will create a drop down list where the value of the option is the sites 
ID. In another part of this form, if there is a value set for $Customer, 
then it will set the $add to selected. This will then make the drop down 
list auto select the customer. 

The code above is passed to another form for processing and is were the 
insert data occurs. Using this method I can echo the form data easily.... 

Hope this helps... 

Aleks 



-----Original Message- 
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 23, 2003 4:33 AM 
To: David Robley 
Cc: [EMAIL PROTECTED] 
Subject: Re: [PHP-DB] Re: Display Mysql Result in drop down list 

Hi: 

then now i'm trying to select a value from the drop down list, echo the 
value i have selected and lastly INSERT the value into DB with the following 
: 
Below's a snippet of code: 

 
//retrieve all "tutor_name" from DB and display in drop down list 

 " 
.$row ["tutor_name"]. "";  }  $result = $db->query($sql); 

?> 
 

 

 
***INSERT selected values into 
DB** $tutor_name = $_POST["tutor_name"]; 

$sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, 
timetable_time) 
VALUES 
('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time' 
)"; 

//execute query statement 
$result = $db->query($sql); 

 


 
*echo the value i have 
selected*** 
 

 


Problem: I was unable to echo the value i selected from drop down as well as 
INSERT into DB...wonder where have i gone wrong??? 
Reali need some help here...all help are greatly appreciated =) Thanks in 
advance. 


Irin. 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Re: Display Mysql Result in drop down list

2003-12-23 Thread Aleks @ USA.net
Hi,

I am looking at your code and have a question, in your code you have

print "" .$row ["tutor_name"].
""; 

Doesn't the SELECTED piece mark everything listed as selected?? When you
bring up the page with the drop down list and open the source, what does it
show??

I handle this  a little differently, I create my drop down list as follows:

=== Code used 

// First I retrieve all customer information

$BB = mysql_query("SELECT * FROM customer ORDER BY CID ");



// Then I create the drop down list




$Sname     $SCity
    $SState     $SCountry \n");  

  }
 
?>



=== Code used 

This will create a drop down list where the value of the option is the sites
ID. In another part of this form, if there is a value set for $Customer,
then it will set the $add to selected. This will then make the drop down
list auto select the customer.

The code above is passed to another form for processing and is were the
insert data occurs. Using this method I can echo the form data easily

Hope this helps...

Aleks



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 23, 2003 4:33 AM
To: David Robley
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: Display Mysql Result in drop down list

Hi:

then now i'm trying to select a value from the drop down list, echo the
value i have selected and lastly INSERT the value into DB with the following
:
Below's a snippet of code:


//retrieve all "tutor_name" from DB and display in drop down list

 "
.$row ["tutor_name"]. "";  }  $result = $db->query($sql);

?>





***INSERT selected values into
DB** $tutor_name = $_POST["tutor_name"];

$sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day,
timetable_time)
VALUES
('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time'
)";

//execute query statement
$result = $db->query($sql);





*echo the value i have
selected***





Problem: I was unable to echo the value i selected from drop down as well as
INSERT into DB...wonder where have i gone wrong???
Reali need some help here...all help are greatly appreciated =) Thanks in
advance.


Irin.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: Display Mysql Result in drop down list

2003-12-23 Thread irinchiang
Hi:

then now i'm trying to select a value from the drop down list, echo the value 
i have selected and lastly INSERT the value into DB with the following :
Below's a snippet of code:


//retrieve all "tutor_name" from DB and display in drop down list


" .$row
["tutor_name"]. "";
 }
 $result = $db->query($sql);

?>





***INSERT selected values into DB**
$tutor_name = $_POST["tutor_name"];

$sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, 
timetable_time)
VALUES 
('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time')";

//execute query statement
$result = $db->query($sql);





*echo the value i have selected***





Problem: I was unable to echo the value i selected from drop down as well as 
INSERT into DB...wonder where have i gone wrong???
Reali need some help here...all help are greatly appreciated =)
Thanks in advance.


Irin.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php