vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Few vbcoding queries (https://vborg.vbsupport.ru/showthread.php?t=189898)

Marco van Herwaarden 09-22-2008 10:08 AM

Well i don't know what you are trying with that explode, so no clue how to correct it. But i doubt you need it at all, try removing it.

Dismounted 09-22-2008 11:19 AM

You wanted to separate all the "time values" and use them in select boxes - so just use the variables $day, $month, $year, etc., as defined by list().

Do you know what list() does?

veenuisthebest 09-22-2008 01:31 PM

I had got it working but the small problem that remained with list() was that it INSERTED the selected value at the top in the list box rather than CHOOSING.

So, after lot of fiddling and referring to profile.php (modifyprofile_birthday template) I reached to this:-

PHP Code:

$row_timestamp explode('-'vbdate('j-n-Y-H-i-s'$result['TIMESTAMP']));
        
$dayselected["$row_timestamp[0]"] = 'selected="selected"';
        
$monthselected["$row_timestamp[1]"] = 'selected="selected"';
        
$year $row_timestamp[2];
        
$hour $row_timestamp[3];
        
$minute $row_timestamp[4];
        
$second $row_timestamp[5]; 

and in template we can do this way:-

HTML Code:

<option value="1" $dayselected[1]>01</option>
<option value="2" $dayselected[2]>02</option>
<option value="3" $dayselected[3]>03</option>

and so on...

Don't you think this is the better way? coz this works perfect and it chooses instead of inserting.

Thanks

Dismounted 09-22-2008 01:57 PM

Errr - my code does exactly the same as yours - assigning $year/$hour/etc...
PHP Code:

$date explode('-'vbdate('j-n-Y-H-i-s'$dateline));
list(
$day$month$year$hour$minute$second) = $date;

$dayselected["$day"] = 'selected="selected"';
$dayselected["$month"] = 'selected="selected"'

And so on...

veenuisthebest 09-22-2008 07:57 PM

okk.. I am facing a strange problem now with list boxes.

I am retreiving a score of 1 to 10 in list box. The number 10 is never retrieved/selected. Only happening with 10.

I have this in PHP

PHP Code:

$scor $result['colscore'];
$score["$scor[0]"] = 'selected="selected"'

and in template:-

HTML Code:

<select name="scscore" size="1" id="scscore">
<option value="1" $score[1]>1</option>
<option value="2" $score[2]>2</option>
<option value="3" $score[3]>3</option>
<option value="4" $score[4]>4</option>
<option value="5" $score[5]>5</option>
<option value="6" $score[6]>6</option>
<option value="7" $score[7]>7</option>
<option value="8" $score[8]>8</option>
<option value="9" $score[9]>9</option>
<option value="10" $score[10]>10</option></select>

Not sure what i am doing wrong !

Thanks

Dismounted 09-23-2008 04:34 AM

Have you tried debugging it yourself? Checking every step for the value?

veenuisthebest 09-23-2008 05:37 AM

oh yes sir, I did check everything, then only i posted.

strange thing is that the scores 1 - 9 are retrieving fine. Its just happening with number 10. When I use text field, it shows fine. Its just some problem with list box selecting 10.

And I just noticed that it is happening with every two digit number like 11, 12 etc. They aren't being selected in the list box. Something with arrays ?

Marco van Herwaarden 09-23-2008 06:11 AM

Are you sure you have the '10' entry in the array. Arrays are 0-based, so 10 entries wil have the values 0-9.

veenuisthebest 09-23-2008 06:18 AM

see all I have is this

What change do I need to make there ?

thanks

veenuisthebest 09-26-2008 05:14 AM

Can somebody please please look into my problem..... I am not able to figure this out.

I am retrieving a score of 1 to 10 in list box. The number 10 is never retrieved/selected. Only happening with 10. However, 1 to 9 retrieve okay. 10 does show using text field BUT not in list box.

I have this in PHP:-

PHP Code:

$scor $result['colscore'];
$score["$scor[0]"] = 'selected="selected"'

and this in template:-

HTML Code:

<select name="scscore" size="1" id="scscore">
<option value="1" $score[1]>1</option>
<option value="2" $score[2]>2</option>
<option value="3" $score[3]>3</option>
<option value="4" $score[4]>4</option>
<option value="5" $score[5]>5</option>
<option value="6" $score[6]>6</option>
<option value="7" $score[7]>7</option>
<option value="8" $score[8]>8</option>
<option value="9" $score[9]>9</option>
<option value="10" $score[10]>10</option></select>

I have no idea what wrong is here.

Thank you.. any help is much appreciated !


All times are GMT. The time now is 12:42 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02940 seconds
  • Memory Usage 1,757KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_html_printable
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete