Current location: Hot Scripts Forums » Programming Languages » PHP » value format


value format

Reply
  #1 (permalink)  
Old 11-06-04, 03:51 AM
franches franches is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Question value format

PHP Code:

<p><select class=select size="120" name="VwRc" style="width: 780; height: 250; FONT-FAMILY: Lucida Console, Courier New; FONT-SIZE: x-small;" LANGUAGE="javascript" onchange="return VwRc_onchange()">

<?    while ($rsTable=mysql_fetch_array($rs))

echo 
"<option>".AppendSpace($rsTable["ActId"],8), AppendSpace($rsTable["ActDate"],12)  ?>
</option>
</select>
this is my code. the data displays on my select box properly. as you will notice i am putting the data from 2 fields in my table in a row of my select box. i have in my form 2 textbox (ID, Date) to check if the data selected from the select box is being displayed. however, if I select something there is no data being displayed in my 2 textbox. I think the option should have a value such as echo "<option value=(this is where my problem starts)>".AppendSpace...

i really don't know what to do anymore. pls help me.



I also tried but nothing is displayed in my selectbox:
PHP Code:

<option value="<? echo $rsTable['ActId'];?>,<? echo $rsTable['ActDate'];?>">&nbsp;&nbsp;<?echo AppendSpace($rsTable["ActId"],8)?>&nbsp;<? echo AppendSpace($rsTable["ActDate"],12)?>

what should be my code then?

hope someone here could help me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-07-04, 02:26 AM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
hello franches,
your way:
PHP Code:

<option value="<? echo $rsTable['ActId'];?>,<? echo $rsTable['ActDate'];?>">&nbsp;&nbsp;<?echo AppendSpace($rsTable["ActId"],8)?>&nbsp;<? echo AppendSpace($rsTable["ActDate"],12)?>

is not common since you use double identifiers for single option. since the option derives from the same row, you can just set the value into the ActId and then check it using your "VwRc_onchange()"
__________________
just an ignorant noob with moronic solution...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-07-04, 09:55 PM
franches franches is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
i have attached my file. hope you have the time to examine it. i have difficulty on how to explain it but i know if you'll be able to see my code you'll know what's my problem.

FilterView.php contains only parts of the code related to my problem. My problem now with my code is the data being displayed inside my select box is only the 1st data of the month. Currently there are five data in my database and only 1 data is displayed which is 2 2004-11-02. second, when i select that data in my pass.ActId box, the data displayed is 2 2004-11-02 which is supposedly it will display 2 and in my pass.ActDate the data displayed is 11 only which should be 2004-11-02. hope you understand my problem.
thank you very much. i am hoping for your response.
Attached Files
File Type: zip manhour.zip (2.9 KB, 104 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-07-04, 10:31 PM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
hello franches,
did you mean this one?
PHP Code:

//File Filter.php

<?    while ($rsTable=mysql_fetch_array($rs))

 
$val AppendSpace($rsTable['ActId'],8) . '' AppendSpace($rsTable['ActDate'],12);
   echo 
'<option value="'$val .'">'$val '</option>';
?>
it should be
PHP Code:

<?    while ($rsTable=mysql_fetch_array($rs)) {


 
$val AppendSpace($rsTable['ActId'],8) . '' AppendSpace($rsTable['ActDate'],12);
   echo 
'<option value="'$val .'">'$val '</option>';
  }
?>
and
PHP Code:

//File FilterOnLoad2.php

<?    while ($rsTable=mysql_fetch_array($rs))

 
$val AppendSpace($rsTable['ActId'],8) . '' AppendSpace($rsTable['ActDate'],12);
   echo 
'<option value="'$val .'">'$val '</option>';
?>
should be
PHP Code:

<?    while ($rsTable=mysql_fetch_array($rs)) {


 
$val AppendSpace($rsTable['ActId'],8) . '' AppendSpace($rsTable['ActDate'],12);
   echo 
'<option value="'$val .'">'$val '</option>';
}
?>
regards,
__________________
just an ignorant noob with moronic solution...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-08-04, 01:22 AM
franches franches is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
thanks all data are now displaying but if I select something all the data are being displayed at my pass.ActId box and xxx is being displayed at pass.ActDate. so I noticed that

i forgot something in
PHP Code:

//File FilterOnLoad2.php 

<?    while ($rsTable=mysql_fetch_array($rs)) 
{
$val AppendSpace($rsTable['ActId'],8) . '' AppendSpace($rsTable['ActDate'],12); 
   echo 
'<option value="'$val .'">'$val '</option>'; }
?>
there should be ',' comma in between the appendspace
PHP Code:

//File FilterOnLoad2.php 

<?    while ($rsTable=mysql_fetch_array($rs)) 
{
$val AppendSpace($rsTable['ActId'],8) . ' , ' AppendSpace($rsTable['ActDate'],12); 
   echo 
'<option value="'$val .'">'$val '</option>'; }
?>
with this code it's now working and if I select something only the 2 which is the ActId is displayed in my pass.ActId and 2004-11-02 is displayed in my pass.ActDate. HOWEVER, in my select box the comma is also being displayed which is not nice to look at. in my select box this is what you will see. what will I do with the comma? i really need your help.
PHP Code:

4         ,2004-11-06

3         
,2004-11-02
2         
,2004-11-01 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-08-04, 09:05 AM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
you can simply rewrite it as:
PHP Code:

//File FilterOnLoad2.php 

<?    while ($rsTable=mysql_fetch_array($rs)) 

$val AppendSpace($rsTable['ActId'],8) . ' , ' AppendSpace($rsTable['ActDate'],12); 
   echo 
'<option value="'$val .'">'$rsTable['ACtDate']. '</option>'; } 
?>
regards,

edit:
$rsTable['ACtDate'] is a typo, so you should write $rsTable['ActDate'] instead
__________________
just an ignorant noob with moronic solution...

Last edited by moronovich; 11-08-04 at 09:26 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 11-08-04, 08:40 PM
franches franches is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

//File FilterOnLoad2.php 

<?    while ($rsTable=mysql_fetch_array($rs)) 

$val AppendSpace($rsTable['ActId'],8) . ' , ' AppendSpace($rsTable['ActDate'],12); 
   echo 
'<option value="'$val .'">'$rsTable['ACtDate']. '</option>'; } 
?>
doing this code would only dispaly on my select box the dates but I still need to display the ActId and some other data such as PrjCode, ActCode and MapNumber since these are data inputed by the user. That's my problem right now and stuck with it. Hoping for your response again. Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I format text from a flat file with CSS? TinnyFusion PHP 3 03-22-04 10:42 AM
date format tcooper PHP 6 12-18-03 01:24 PM
Mail using html format woyrz PHP 7 12-12-03 09:12 AM
Need perl manual in hlp or chm format khibinite Perl 3 12-09-03 07:22 AM
help plz: format retrieved Mysql data in HTML with PHP paulj000 PHP 2 10-19-03 09:03 PM


All times are GMT -5. The time now is 09:43 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.