473,657 Members | 3,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to retrieve the values of dynamically created textboxes

5 New Member
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=$assocAr ray[$i].$dat1;

$name2=$assocAr ray[$i].$d1;


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


echo"<tr>";
echo "<td><input type=textbox name='.$assocAr ray[$i].' value='$assocAr ray[$i]'></td>";
echo "<td><input type=textbox name=$date1 size=3 value=$date1><a href=javascript : openAddcomments Popup();><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.p hp><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
}
//<img src=images/notes.bmp><a href=javascript : openAddcomments Popup(); class=addimg></a></nobr></td>";
if($d2<=$cnt)
{
echo "<td><input type=textbox name=name2 size=3><a href='javascrip t: openAddcomments Popup();'><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 : openAddcomments Popup();><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 : openAddcomments Popup();><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 : openAddcomments Popup();><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 : openAddcomments Popup();><img src=images/notes.bmp width=14 height=14 title=Add comments class=addimg/></a></td>";
}

echo"</tr>";
}

?>
</table>


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

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

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

$task=$assocArr ay[$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,subtask Code,dated,work Hr)VALUES($_SES SION[empid],'$task','$date 1','$val1'),($_ SESSION[empid],'$task','$txtd ate1','$val2'), ($_SESSION[empid],'$task','$txtd ate2','$val3'), ($_SESSION[empid],'$task','$txtd ate3','$val4'), ($_SESSION[empid],'$task','$txtd ate4','$val5'), ($_SESSION[empid],'$task','$txtd ate5','$val6'), ($_SESSION[empid],'$task','$txtd ate6','$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 5909
Markus
6,050 Recognized Expert Expert

Please read the forum guidelines


Then post the code with the *correct* code tags.
Jan 31 '08 #2
ifedi
60 New Member
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
351
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. I get the error "Referenced object has a value of 'Nothing'". as indicated in the code below: For Each c In Controls If i < maxRow Then
4
1784
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 the relevant text properties of several textboxes (to allow for edit) ....all simple so far. I have a save button that when clicked will then perform the writing back of the text in the textboxes. The problem is (and having debugged I see this)...
3
1234
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, I need to pass those textboxes values to another for to build the parameters for a report. Here is the sample:
5
1697
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 user filled in in another page. But suppose there were 3 values. In that case, I know the names of the fields, they are MyTextBox1 MyTextbox2 MyTextbox3
17
5544
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 two buttons namely "Edit" and "Delete" are present. If I click the "Edit" button the values in that particular cells should go back to the textboxes for editing and then after editing it should go to the corresponding place. Can any one help to...
1
1104
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 ASAP.
1
1436
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 company_id,company_name from company_master"); } }
1
6310
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 the following "DateTextBox" class module). Whenever a user enters in to the textbox, the code displays "Please enter date in mm/dd/yyyy format (for ex: 01/01/2009)." message which is accomplished using "MouseUp" event. And, I used "Exit" event to...
2
1387
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() End If Dim ds As New DataSet Dim name, unit ,namunt As String da.Fill(ds, "sys_params")
0
8384
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8718
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7314
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.