473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to retrieve the values of dynamically created textboxes

Hi,

I hav created a group of textboxes using a loop and its names are unique and names are assigned using variable ( like <input type=text name=$name1>). Then How can i retrieve the values in that textboxes after a button click with in a loop. Really I cant move from here. Can anyone plz help me..
Part of the my code is given below
<html>
<table>
<?php
// i hav an array "assocArray" and its count is "countarray"
for($i = 1; $i < $countarray ; $i++)
{



$name1=$assocArray[$i].$dat1;

$name2=$assocArray[$i].$d1;


$name3=$assocArray[$i].$d2;
$name4=$assocArray[$i].$d3;
$name5=$assocArray[$i].$d4;
$name6=$assocArray[$i].$d5;
$name7=$assocArray[$i].$d6;


echo"<tr>";
echo "<td><input type=textbox name='.$assocArray[$i].' value='$assocArray[$i]'></td>";
echo "<td><input type=textbox name=$date1 size=3 value=$date1><a href=javascript: openAddcommentsPopup();><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
if($d1<=$cnt) //these are some conditions ,they are all working fine
{
echo "<td><input type=textbox name=$name1 size=3 ><a href=comments.php><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
}
//<img src=images/notes.bmp><a href=javascript: openAddcommentsPopup(); class=addimg></a></nobr></td>";
if($d2<=$cnt)
{
echo "<td><input type=textbox name=name2 size=3><a href='javascript: openAddcommentsPopup();'><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
}

if($d3<=$cnt)
{
echo "<td><input type=textbox name=$name3 size=3><a href=javascript: openAddcommentsPopup();><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
}
if($d4<=$cnt)
{
echo "<td><input type=textbox name=$name4 size=3><a href=javascript: openAddcommentsPopup();><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
}
if($d5<=$cnt)
{
echo "<td><input type=textbox name=$name5 size=3><a href=javascript: openAddcommentsPopup();><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
}
if($d6<=$cnt)
{
echo "<td><input type=textbox name=$name6 size=3><a href=javascript: openAddcommentsPopup();><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
}

echo"</tr>";
}

?>
</table>


<input type="submit" name="savetimesheet" value="Save Time-Track">

//here im able echo the $name1,$name2...
<?php
if(isset($_REQUEST['savetimesheet']))
{

for($i = 1; $i < $countarray ; $i++)
{

$task=$assocArray[$i];


$val1=$_POST['$date1'];

$val2=$_POST[$name1];


$val3=$_POST[$name2];
echo $val3;


$val4=$_POST[$name3];



$val5=$_POST[$name4];



$val6=$_POST[$name5];


$val6=$_POST[$name6];



$query="INSERT INTO timesheetentry(empCode,subtaskCode,dated,workHr)VA LUES($_SESSION[empid],'$task','$date1','$val1'),($_SESSION[empid],'$task','$txtdate1','$val2'),($_SESSION[empid],'$task','$txtdate2','$val3'),($_SESSION[empid],'$task','$txtdate3','$val4'),($_SESSION[empid],'$task','$txtdate4','$val5'),($_SESSION[empid],'$task','$txtdate5','$val6'),($_SESSION[empid],'$task','$txtdate6','$val7')";
$result = $d->query($query);
}
}
?>
Iam not getting the value in the textboxes and so not able to insert the data in the textboxes.

Plz help me.....
Jan 31 '08 #1
2 5889
Markus
6,050 Expert 4TB

Please read the forum guidelines


Then post the code with the *correct* code tags.
Jan 31 '08 #2
ifedi
60
Too difficult to sift through your code without code syntax markup.
Feb 8 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Victor | last post by:
I have dynamically created n number of text boxes in a form like txtQL(1), txtQL(2) , ...txtQL(n) How can I retrieve the values in a loop? I'm confused as to how to approach this! Please help. ...
4
by: Mark Broadbent | last post by:
This one has got me absolutely stumped. At work I have created a simple web form that gets data from a sql backend and puts this to a dataset. I have an edit button that when clicked will set...
3
by: SD | last post by:
Hello, I have a form that has a panel container where I'm adding textboxes dynamically based on a query to database, so I'm looping through the records. The problem I have is that once built,...
5
by: BLACKDOG157 | last post by:
I've made a form with a variable number of textboxes. The user fills them out, and then I need to pick up the values he has filled in. The number of textboxes vary depending on a value that the...
17
by: cygsoft | last post by:
Hi I have created a dynamic row and inserted the values into the cells of those rows from textboxes. Now I have to edit those values stored in the rows. At the end of each row created dynamically...
1
by: Anuj Sharma | last post by:
Hi all, i surf websites from the past 10 hours, but i m not getting any good answer, about my problem "How can i get values from dynamically created textboxes" if any one knows the best, reply...
1
by: sejal17 | last post by:
Hello everyone, Below is my code: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { touchpay.fillcombo(dpwcompany, "select...
1
by: JFKJr | last post by:
Hello everyone, the following Access VBA code opens an excel file and creates textboxes in a given range of cells dynamically. The code attaches "MouseUP" and "Exit" events to the textboxes (using...
2
by: bharathi228 | last post by:
my code for retrieving values from database Dim da As New SqlDataAdapter("select parameter_name,parameter_units from sys_params", con) If con.State = ConnectionState.Closed Then con.Open()...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.