Current location: Hot Scripts Forums » General Web Coding » JavaScript » Javascript vs PHP, problem with arrays


Javascript vs PHP, problem with arrays

Reply
  #1 (permalink)  
Old 10-03-03, 04:01 AM
Chuff Chuff is offline
New Member
 
Join Date: Oct 2003
Location: Bruxelles - Belgium
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Javascript vs PHP, problem with arrays

I have a PHP class that generates the following (HTML & Javascript)
It is a date entry, with a button "Today" that sets the select fields to the current value.
I use for this an array named "dateclose", and it did not work (the button Today does not set the select fields to current date)

However, if I use 3 variables, named dateclose0, dateclose1 and dateclose2, and I modify the javascript according to this, it works.

How can I have my javascript work, yet using the array dateclose instead of using 3 different variables ?

<!-- Day select -->
<select name="dateclose[0]">
<option value="">day</option>
<option value="01">01</option>
</select>
...
<option value="31">31</option>
<!-- Month select -->
<select name="dateclose[1]">
<option value="">month</option>
<option value="01">Jan</option>
<option value="02">Feb</option>
...
<option value="12">Dec</option>
</select>
<!-- Year select -->
<select name="dateclose[2]">
<option value="">year</option>
<option value="2008">2008</option>
...
<option value="1909">1909</option>
</select>
<!-- Button Today -->
<input type=button name=today value='Today'
onclick="this.form.dateclose[2].selectedIndex = 6;
this.form.dateclose[1].selectedIndex = 10;
this.form.dateclose[0].selectedIndex = 03;">
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
php and javascript together? gamextremer2003 PHP 5 11-06-03 02:18 PM
PHP to JAVASCRIPT: 2D Array Conversion 770 PHP 4 11-05-03 02:47 PM
Problem with Read from file by PHP Pothik Script Requests 5 09-15-03 08:42 AM
PHP confige problem Cmrdrv PHP 1 08-12-03 07:40 PM
Php and apache problem Cmrdrv PHP 26 08-03-03 10:35 PM


All times are GMT -5. The time now is 11:02 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.