473,563 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing field value to a php page

Hi,
I am trying to pass the value of a field to a PHP file like this:

<input type="hidden" name="field1" id="field1" value="123">
<input type="hidden" name="field2" id="field2" value="456">

<a href =
"test.php?c1=do cument.getEleme ntById('field1' ).value&c2=docu ment.getElement ById('field2'). value
<img src="add.gif" border="0"></a>


In test.php, when I do:

c1=$_GET['c1'] ;
echo c1;

I get:

c1 = document.getEle mentById(\'fiel d1\').

Feb 12 '06 #1
1 1545
Xerxes wrote:
I am trying to pass the value of a field to a PHP file like this:

<input type="hidden" name="field1" id="field1" value="123">
<input type="hidden" name="field2" id="field2" value="456">

<a href =

"test.php?c1=do cument.getEleme ntById('field1' ).value&c2=docu ment.getElement ById('field2'). value
<img src="add.gif" border="0"></a>


In test.php, when I do:

c1=$_GET['c1'] ;
echo c1;

I get:

c1 = document.getEle mentById(\'fiel d1\').


Of course. It is rather astounding that you get anything at all, since
the attribute value is not Valid (it has not been properly delimited.
The value of the `href' attribute is specified to be URI reference.
Script data is not evaluated in URIs references automatically. However,
you do not need any script code or IDs here:

<form action="test.ph p">
<div>
<input type="hidden" name="c1" value="123">
<input type="hidden" name="c2" value="456">
<button><img src="add.gif" alt="Add" border="0"></button>
</div>
</form>

You should be aware that this works in HTML 4-compliant user agents only
because of the `button' element.

<URL:http://www.w3.org/TR/html4/interact/forms.html#edef-BUTTON>
HTH

PointedEars
Feb 12 '06 #2

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

Similar topics

5
5931
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page contains: <?php $_SESSION = ""; $_SESSION = "";
1
7772
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION =...
1
7424
by: Newbie | last post by:
OK, this may be impossible since I'm using 3rd party shopping cart ASP software, but I've been able to finagle a lot of other stuff I thought wouldn't work, so here we go: I'm using a form in which users enter numbers to be calculated into a square footage cost. Upon submitting, the results page uses ASP to give the total and the chance to...
4
1630
by: bateman | last post by:
Hi, I have a rather puzzling problem, have asked the ASP experts at work with no joy and its driving me mad! I'll explain the steps in more detail below but the general problem is I am manually creating a datetime value in my asp pages that I am putting in a session. Now this isn't being passed from page to page while other session objects...
12
6521
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html ...
1
4584
by: Kevin Lyons | last post by:
Hello, I am trying to get all of my form elements passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html to the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing name, email, countries, cities, products, courses, etc. The others display as they should...
6
4040
by: djjohnst | last post by:
I am creating a program that will list program times for people who visit our website. Users can login create, edit, delete a program. These dump into a database. The ASP webpage then reads from the database and posts these programs for people to view (program type, date, time, etc...). I am having trouble creating an edit option. When bring...
4
2202
by: zion | last post by:
Hello, In my Aspx.cs page in Page_load event I have for example: String x; x = "10"; How can I use the x value in a javascript function in the Aspx page? thanks
7
3336
by: EyeHawk | last post by:
I’m fairly new on ASP and Javascript programming, I have read as much as I can to develop my website in a user friendly manner. I’m using javascript to pass some values in a Form, but is no working, I have tried to research, but being such a specific problem I haven’t being able to find any answers. Hope Somebody Can Help Me or put me in the right...
0
7659
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...
0
7580
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...
0
8103
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...
0
7945
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
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...
1
5481
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3634
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.