Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] Multi Row Form


Multi Row Form

Reply
  #1 (permalink)  
Old 09-10-09, 05:21 AM
kavionly kavionly is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Multi Row Form

Hi,
I have a multi row form . I am not able to select the time for all rows. Can anyone help me pls?

Here is my code
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script language="javascript" src="mootools.v1.11.<acronym title="JavaScript"><acronym title="JavaScript"><acronym title="JavaScript">js</acronym></acronym></acronym>"></script>
<script language="javascript" src="nogray_time_picker_min.<acronym title="JavaScript"><acronym title="JavaScript"><acronym title="JavaScript">js</acronym></acronym></acronym>"></script>
<script language="javascript">
window.addEvent("domready", function (){
var tp2 = new TimePicker('time2_picker', 'time2', 'time2_toggler', {format24:true});
var tp3 = new TimePicker('time3_picker', null, null, {visible:true, onChange:function(){
if (this.time.hour < 12) var ampm = this.options.lang.am;
else var ampm = this.options.lang.pm;
var hour = this.time.hour%12;
if (hour < 10) hour = "0"+hour;
var minute = this.time.minute;
if (minute < 10) minute = "0"+minute;
//$('time3_value').setHTML(hour+":"+minute+" "+ampm);
}});
	});
</script>
<style>
* {
	font-family:Arial, Helvetica, sans-serif;
	font-size:9pt;
}
/* table list */
	.table_list {
	border-collapse:collapse;
	border:solid #cccccc 1px;
	width:100%;
}
.table_list td {
	padding:5px;
	border:solid #efefef 1px;
}
.table_list th {
	background:#75b2d1;
	padding:5px;
	color:#ffffff;
}
.table_list tr.odd {
	background:#e1eff5;
}
.time_picker_div {
	padding:5px;
	border:solid #999999 1px;
	background:#ffffff;
}
</style>
</head>
<body>
  <script type="text/javascript">
   var AdBrite_Title_Color = '0000FF';
   var AdBrite_Text_Color = '000000';
   var AdBrite_Background_Color = 'FFFFFF';
   var AdBrite_Border_Color = 'FFFFFF';
</script>
<form method="post" action="timer.php">
<table>
]<?php
$i=0;
while($i<=5)
{
  $i++;
?>  
<tr>
<td>
<input type="text" name="time2[]" id="time2" />
<a href="#" id="time2_toggler">Open Time picker</a>
<div id="time2_picker" class="time_picker_div"></div>
</td>
</tr>
<?php
}
?>
</table>
</form>
</center>
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old 09-10-09, 03:00 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Code:
<input type="text" name="time2[]" id="time2" />
<a href="#" id="time2_toggler">Open Time picker</a>
<div id="time2_picker" class="time_picker_div"></div>
Change time2_picker in these lines to look like this:

PHP Code:

<div id="time<?php echo $i?>_picker" class="time_picker_div"></div>
It looks like you want to create 5 sets of the HTML. The ids must be unique. You will have to change all the 2s to use the PHP echo of $i.
Reply With Quote
  #3 (permalink)  
Old 09-11-09, 01:53 AM
kavionly kavionly is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
i changed.. still not getting
Reply With Quote
  #4 (permalink)  
Old 09-11-09, 06:13 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Please post your updated code.
Reply With Quote
  #5 (permalink)  
Old 09-14-09, 12:13 AM
kavionly kavionly is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
here is the code

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script language="javascript" src="mootools.v1.11.js"></script>
<script language="javascript" src="nogray_time_picker_min.js"></script>
<script language="javascript">
window.addEvent("domready", function (){
//svar statesSelectObj = document.getElementById('time[]'+number);

var tp2 = new TimePicker('time1_picker', 'time2', 'time1_toggler', {format24:true});

var tp3 = new TimePicker('time2_picker', null, null, {visible:true, onChange:function(){
if (this.time.hour < 12) var ampm = this.options.lang.am;
else var ampm = this.options.lang.pm;
var hour = this.time.hour%12;
if (hour < 10) hour = "0"+hour;
var minute = this.time.minute;
if (minute < 10) minute = "0"+minute;
//$('time3_value').setHTML(hour+":"+minute+" "+ampm);
}});
	});
</script>
<style>
* {
	font-family:Arial, Helvetica, sans-serif;
	font-size:9pt;
}
/* table list */
	.table_list {
	border-collapse:collapse;
	border:solid #cccccc 1px;
	width:100%;
}
.table_list td {
	padding:5px;
	border:solid #efefef 1px;
}
.table_list th {
	background:#75b2d1;
	padding:5px;
	color:#ffffff;
}
.table_list tr.odd {
	background:#e1eff5;
}
.time_picker_div {
	padding:5px;
	border:solid #999999 1px;
	background:#ffffff;
}
</style>
</head>
<body>
  <script type="text/javascript">
   var AdBrite_Title_Color = '0000FF';
   var AdBrite_Text_Color = '000000';
   var AdBrite_Background_Color = 'FFFFFF';
   var AdBrite_Border_Color = 'FFFFFF';
</script>
<form method="post" name="form1" id="form1" action="timer.php">
<table>
<?php
$i=0;
while($i<=5)
{
  $i++;
?>  
<tr>
<td>
<input type="text" name="time2[]" id="time<?php echo $i?>" />
<input type="button" align="top"  ></strong></td>
<a href="#" id="time<?php echo $i?>_toggler">Open Time picker</a>
<div id="time<?php echo $i?>_picker" class="time_picker_div"></div>
</td>
</tr>
<?php
}
?>
</table>
</form>
</center>
</body>
</html>
Reply With Quote
  #6 (permalink)  
Old 09-14-09, 06:38 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
The input name attribute must be updated.

<input type="text" name="time2[]" id="time<?php echo $i?>" />
Reply With Quote
  #7 (permalink)  
Old 09-14-09, 07:22 AM
kavionly kavionly is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Ok thanks i changed that but i am getting only for one input box.
Reply With Quote
  #8 (permalink)  
Old 09-14-09, 09:03 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
post your code for "timer.php"
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
Space Above Form xavier039 CSS 1 07-13-09 10:52 PM
[SOLVED] Multi script PayPal add to cart order form Tito1 JavaScript 5 02-23-09 04:21 AM
ajax checking and onsubmit issue follower JavaScript 4 10-12-08 03:45 PM
checkCheckboxGroup broken after form consolidation ski_woman JavaScript 0 01-12-05 11:00 AM
formmail problem gscraper Perl 12 08-27-04 03:06 AM


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