473,772 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing Data without Submit/Input

I want to get the user's choice of some menu items, and pass them to a
(PHP) page in the URL, rather than with "Submit" button. I tried
this, but it doesn't work:

<a href="pagetwo.p hp?says=meaning "><img src="smiley.gif "></a>

Pick one from drop-down menu:
<p>
<form>
<select name=meaning>
<option>Dopey
<option>Sneez ey
<option>Grump y
</select>
</form>
Jul 23 '05 #1
16 9535

"Ben Sharvy" <bs*****@mac.co m> wrote in message
news:d1******** *************** ***@posting.goo gle.com...
I want to get the user's choice of some menu items, and pass them to a
(PHP) page in the URL, rather than with "Submit" button. I tried
this, but it doesn't work:

<a href="pagetwo.p hp?says=meaning "><img src="smiley.gif "></a>
Replace with:
<script type="text/javascript">
document.write ('<a
onclick="docume nt.forms['myForm'].submit();"><im g src="smiley.gif "></a>');
</script>

Use script to write this link, because if Javascript support is unavailable
or turned off then the link wouldn't work anyway. In that case, it's replace
below, inside a NOSCRIPT element, by the Submit button that you're trying to
avoid.

Pick one from drop-down menu:
<p>
<form>
Replace with:
<form id="myForm" action="pagetwo .php" method="get">
<select name=meaning>
<option>Dopey
<option>Sneez ey
<option>Grump y
</select>
Insert:
<noscript>
<input type="submit" name="submit" value="Submit">
</noscript>
</form>


Jul 23 '05 #2
Isn't there a way to do it without javascript?
Jul 23 '05 #3
bs*****@mac.com (Ben Sharvy) wrote:
Isn't there a way to do it without javascript?


No.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #4
"Harlan Messinger" <hm************ *******@comcast .net> a écrit dans le
message de news:l5******** *************** *********@4ax.c om
Isn't there a way to do it without javascript?


No.


Err...

<input type="image" src="..." ...>

See :
http://www.w3.org/TR/html401/interac....html#h-17.4.1

Jul 23 '05 #5
"Pierre Goiffon" <pg******@nowhe re.invalid> wrote:
"Harlan Messinger" <hm************ *******@comcast .net> a écrit dans le
message de news:l5******** *************** *********@4ax.c om
Isn't there a way to do it without javascript?


No.


Err...

<input type="image" src="..." ...>


That doesn't do what he wanted to do. He wants a link outside of the
form.
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #6
"Harlan Messinger" <hm************ *******@comcast .net> a écrit dans le
message de news:oa******** *************** *********@4ax.c om
Isn't there a way to do it without javascript? No.
Err... <input type="image" src="..." ...>
That doesn't do what he wanted to do. He wants a link outside of the
form.


I can't understand the difference between the solution you proposed :

----
<form id="myForm" action="pagetwo .php" method="get">
....
<script type="text/javascript">
document.write ('<a
onclick="docume nt.forms['myForm'].submit();"><im g src="smiley.gif "></a>');
</script>
<noscript>
<input type="submit" name="submit" value="Submit">
</noscript>
----

And this other one :

----
<form id="myForm" action="pagetwo .php" method="get">
....
<input type="image" src="smiley.gif " ...>
----

Can you please explain ?

Jul 23 '05 #7
"Pierre Goiffon" <pg******@nowhe re.invalid> wrote:
"Harlan Messinger" <hm************ *******@comcast .net> a écrit dans le
message de news:oa******** *************** *********@4ax.c om
> Isn't there a way to do it without javascript? No. Err... <input type="image" src="..." ...>

That doesn't do what he wanted to do. He wants a link outside of the
form.


I can't understand the difference between the solution you proposed :

----
<form id="myForm" action="pagetwo .php" method="get">
...
<script type="text/javascript">
document.write ('<a
onclick="docum ent.forms['myForm'].submit();"><im g src="smiley.gif "></a>');
</script>
<noscript>
<input type="submit" name="submit" value="Submit">
</noscript>
----

And this other one :

----
<form id="myForm" action="pagetwo .php" method="get">
...
<input type="image" src="smiley.gif " ...>
----

Can you please explain ?


I'm sorry, it was a brain fart. You're right. Never mind.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #8
Harlan Messinger <hm************ *******@comcast .net> wrote:
"Pierre Goiffon" <pg******@nowhe re.invalid> wrote:
"Harlan Messinger" <hm************ *******@comcast .net> a écrit dans le
message de news:oa******** *************** *********@4ax.c om
>> Isn't there a way to do it without javascript?

> No.

Err...

<input type="image" src="..." ...>

That doesn't do what he wanted to do. He wants a link outside of the
form.


I can't understand the difference between the solution you proposed :

----
<form id="myForm" action="pagetwo .php" method="get">
...
<script type="text/javascript">
document.write ('<a
onclick="docu ment.forms['myForm'].submit();"><im g src="smiley.gif "></a>');
</script>
<noscript>
<input type="submit" name="submit" value="Submit">
</noscript>
----

And this other one :

----
<form id="myForm" action="pagetwo .php" method="get">
...
<input type="image" src="smiley.gif " ...>
----

Can you please explain ?


I'm sorry, it was a brain fart. You're right. Never mind.


No, wait--I *was* right; when I wrote the above, I wasn't remembering
part of my original reasoning. Part of what he wanted (at least, as I
understood it) was to have the link outside of the form. The code I
provided wasn't meant to be inserted into the form, it was meant to
replace the link the OP was trying to use, in the same position.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 23 '05 #9
Harlan Messinger wrote:
<script type="text/javascript">
document.write ('<a onclick="docume nt.forms['myForm'].submit();"><im g
src="smiley.gif "></a>');
</script>

Use script to write this link, because if Javascript support is
unavailable or turned off then the link wouldn't work anyway. In that
case, it's replace below, inside a NOSCRIPT element, by the Submit
button that you're trying to avoid.


This is not the best authoring practices. What if js is enabled but the
code contains an error? Neither the js submit nor the <noscript> submit
button will be available.

Better solution: create a fully functioning <form>, and use js to modify
the dom, removing the <input type=submit> and adding a js submit mechanism.

But then, the best solution for the op is to KISS, and use a normal form.

--
Brian (remove "invalid" to email me)
http://www.tsmchughs.com/
Jul 23 '05 #10

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

Similar topics

5
5942
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
7789
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 = ""; echo "<form method='POST' action='login.php'>
3
2080
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed to get a working system just about finished. I am building an interface for our customer service folks to use to manage registered customers and am seeing some weird behavior.
2
2548
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text, radio, checkbox, and dropdown. When the form Submit button is clicked, I then need the input data either written to another location on the same page, or written to another page (a different frame would be fine)
10
2907
by: Noozer | last post by:
Below is some ASP, HTML and javascript. It is part of a page used to maintain a small database. This code did work at one time, but has since stopped. For some reason the data on my form is not being passed to the page specified in the Action property of the form. This is on a Windows 2000 Pro PC. I copied the code to another server (Windows XP Pro machine) and it DOES work as expected there. The first block is the data located near...
3
1777
by: Patrick Olurotimi Ige | last post by:
How can i send LOGON_USER or User.Identity.Name to the Database? I'm working on a survey which is intranet based with Windows Authentication. I can get the current user by calling LOGON_USER or User.Identity.Name ! But i want to pass(the current user) to a table in DB! I was thinking of ussing hidden textboxes like so :- Is it a good approach.. Any ideas appreciated!
7
2790
by: Khai | last post by:
First off, yes, I understand the crapload of tutorials out there, (well, rather, I understand there /are/ a crapload of tutorials out there), the problem is my comprehension. I'm trying to pass variables, and can do so just fine with a URL, and $_GET. What I would like to learn, and be very adept at using is the Form functions and how you pass through that. The problem in my comprehending this, is how does the original page know how...
4
2315
by: jej1216 | last post by:
I'm pretty new to PHP and MySQL. I have managed to create a form that inserts data to MySQL and to create a form to search the DB. Now here is my problem. I am unsuccessful coding a hidden variable in an update page. Here is what I have: search_ir.php (this page searches the DB and lists incident_id's found. User then enters the incident_id of the row to update): .... <FORM METHOD="POST" ACTION="edit_ir.php"> <h3>Enter the Incident...
3
6882
by: ToddFur | last post by:
I see several postings on this but I am still unable to figure out my problem. I can pass the values of my text field but not radio button (or even checkboxes). My PHP file <?php //declare our variables $day = $_GET; $date = $_GET; $groupname = $_GET;
0
9454
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
10261
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...
1
10038
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
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...
1
7460
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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

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.