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.

Find element name based on value match

I have a form that dynamically generates Submit buttons. I want all the buttons to display the same text "More info" while their names are dynamically generated numeric names (they point to database record numbers).

Obviously when the form returns, only one button will have been clicked. So I want to look in $_POST for a value "More info" and then ask the name of the button! The integer value of the name will be the record I display to the user, containing the More info they wanted. I have this working fine the other way round - when the value is the record number (ie the record number shows on the button face) - but I don't want the numbers showing.

So my question is, how can I get the name of a form element returned, based on finding an element in the $_POST array with the desired value?
Mar 22 '07 #1
6 1724
ak1dnar
1,584 Expert 1GB
This is exactly a crap, i can't understand anything make it in to steps.

As i feel. you are going to populate a button for more info based on a record.
then once you click the button another button will display. ok fine.
in that button face do you need to print some thing. ?

Please :)
Mar 22 '07 #2
I will be displaying a form, which contains a table, and in each row of the table is just a few fields from a record. The records that are shown will depend on what the user searched for.

When the user sees a record that looks like what he needs, he should be able to click a button to view the whole of that record. A button is generated on each row of the table.

At this time, I have all the buttons named "MoreInfo", and I have the record number showing on the button, because I am defining that as the "value". I test the value of $_POST['MoreInfo'] and open that record. This is working very well.

However, I don't want the record number showing on the button, I want the button to say "More Info". So I would therefore like to give each button the "value" of "More Info" and the "name" of $recordnumber
Mar 22 '07 #3
ak1dnar
1,584 Expert 1GB
If you can print multiple forms like this you can made it.
print the value=" here " in hidden fields.

[PHP]<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<!-- wrap your <TR> with Forms and Dynamically print this value = " echo ID here "-->
<form action="more.php" method="post" name="more">
<input name="info" type="hidden" value="1001"/>
<input type="submit" value="More Info"/>
</form>
<BR>
<form action="more.php" method="post" name="more">
<input name="info" type="hidden" value="1002"/>
<input type="submit" value="More Info"/><BR>
</form>
</body>
</html>[/PHP]

more.php
[PHP]<?
$more_info = $_POST['info'];
echo $more_info;
?>[/PHP]
Mar 22 '07 #4
Thanks, that's a way round it. So are you saying it is *not* possible to deduce the name of a form element from the $_POST array? It seemed to me that would be more direct and efficient, if it was possible.
Mar 22 '07 #5
Actually sorry I have just realised I cannot use that. All the buttons must be on the same form as there is tons of other stuff I need to transmit, such as what the search terms were, the filter chosen, the number of records already shown etc. In fact that's why I am trying to use submit buttons instead of having "more info..." links - because of the large amount of data I would have to include in that link. After the user finishes with the individual record, they are supposed to go back to their filtered list to carry on browsing.
Mar 22 '07 #6
ak1dnar
1,584 Expert 1GB
Actually sorry I have just realised I cannot use that. All the buttons must be on the same form as there is tons of other stuff I need to transmit, such as what the search terms were, the filter chosen, the number of records already shown etc. In fact that's why I am trying to use submit buttons instead of having "more info..." links - because of the large amount of data I would have to include in that link. After the user finishes with the individual record, they are supposed to go back to their filtered list to carry on browsing.
Happy Coding !
thread is open for you. either me or these guys will help you. give it a try. ;)
Mar 23 '07 #7

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

Similar topics

1
by: Stuart A Yeates | last post by:
I'm trying to write a template that matches "*" but which has an if clause which if only executed once per type of element seen (where all elements of a type have the same name and namespace). The...
2
by: Martin | last post by:
Hallo, can you help me writing a generic xslt transformation (useable with xsql from oracle)? The problem is how to get the escaping characters .... === INPUT-File in.xml <?xml version =...
4
by: celerystick | last post by:
This is an xsl question, comp.infosystems.www.authoring.stylesheets were not able to help , here goes .... With one xml file containing repeated element <subject>: ...
9
by: Bernd.Moos | last post by:
Given the following XML document: <text> <p> <w>Ronaldo</w> <w>scoredw> <w>the</w> <w>1</w> <c>:</c> <w>1</w>
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
1
by: Tomas | last post by:
When I try to load my xslt i get an xml exception with the message "Root element is missing". The stylesheet works when I preview it in stylus studio, but apparently not in my application. Any...
3
markmcgookin
by: markmcgookin | last post by:
Hi, I have the following XML <AnswerList xmlns="http://tempuri.org/ALPS_Assessmentv1p1_RESCO_Schema.xsd"> <DateTimeLastSaved>12:12:12 1900</DateTimeLastSaved> <UserName>Bob</UserName>...
5
by: saran3b2 | last post by:
Hi all, If u know the solution please suggest me. I need these urgent. production.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="xsl/vinoth-new.xsl"?>...
6
by: John Larson | last post by:
Hi All, I am some information from INSPEC database records in XML to build a relational database of my own. I am currently trying to extract information by doing an XSLT transform of the XML...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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
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...
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
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.