473,513 Members | 2,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript accessing i.e "data[3]" in a form

Hi

I am working on a PHP-script and need javascript to set the value of a
hidden field in a form. This field happens to be an entry in an array
data[3] according to my example. How can I do this?

Below is listet two PHP-pages: one that doesn't work (to my dismay), and
another that does work, but do not use an array entry in the hidden field.

Thanks

Esben

---------- Doesn't work as planned -----------------
<? print "data[3]=".$data[3]."\n";?>
<form action='<?$PHP_SELF?>' name='edit_form' method=post
enctype='multipart/form-data'>
<input type=hidden name='data[3]' value='default :-('>
<script language='javascript'>
document.edit_form.data[3].value = 'not default :-)';
</script>
<input type='submit'></form>
----------------------------------------------------------

----------Doesn't use arrays----------------------------
<? print "data3=".$data3."\n";?>
<form action='<?$PHP_SELF?>' name='edit_form' method=post
enctype='multipart/form-data'>
<input type=hidden name='data3' value='default :-('>
<script language='javascript'>
document.edit_form.data3.value = 'not default :-)';
</script>
<input type='submit'></form>
----------------------------------------------------------
Jul 23 '05 #1
1 1508


Esben Rune Hansen wrote:

I am working on a PHP-script and need javascript to set the value of a
hidden field in a form. This field happens to be an entry in an array
data[3] according to my example. How can I do this?


Check the FAQ:
http://jibbering.com/faq/
there you find
http://jibbering.com/faq/#FAQ4_25
http://www.jibbering.com/faq/faq_not...kets.html#illc

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
29059
by: Steven K | last post by:
Hello, I am using an asp page (upload.asp) to gather information and to upload files to the web server using SoftArtisans SAUpload Tool. In the first page (upload.asp), I have a form for...
3
4679
by: 21novembre | last post by:
Hi all, I made a question several days before to describe my strange trouble of mysqldump. But I still can't figour it out. Well, I just want to ask another question whether I could just backup...
6
5225
by: Jon Davis | last post by:
I recently learned how to do an <OBJECT> alternative to <IFRAME> in current browsers using: <object id="extendedhtml" type="text/html" data="otherpage.html" width="250" height="400"></object> ...
8
25333
by: Jerry | last post by:
I have an off-the-shelf app that uses an Access database as its backend. One of the tables contains a field with an "OLE Object" datatype. I'm writing some reports against this database, and I...
7
2635
by: Alex Maghen | last post by:
Hi. I had previously installed VS2005 beta 1. I carefully followed all the steps (I thought) to deinstall it and then installed beta 2. According to the documentation, the "Data" directory which...
6
5818
by: P. Prosper | last post by:
Hello, Sorry for the cross-posting, I first posted this message to the vb.6 NG (wrong group) <g>. Are there any add-in or tools out there (for VB.NET ) that would allow one to drag and drop...
1
1518
by: Stimp | last post by:
I have an asp.net page with a form and several <INPUT type=fileinput fields so that I can upload images via the form. I also have about 30 other standard dropdownlists and text boxes as part of...
3
9225
by: nkoriginal | last post by:
Hello: I tried an script for keep my data form after reload page, but I've some errors. In this momento I runnung my own browser because we've an intranet. And for security reason, our page...
4
32491
by: vunet.us | last post by:
Hi all, I am converting my app to AJAX-based. I have a form that submits some data including images. When I use AJAX XmlHttpRequest I am unable to submit the form with...
0
7257
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,...
0
7379
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,...
0
7535
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
7521
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
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
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 ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
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...

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.