473,566 Members | 3,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to transferring form data through Url "Get" method?

10 New Member
Hey I have a short little poll thing and i'd like to transfer the results to another page through url like
...com/?x=12&y=55 hers what I got so far:
by the way my website doesn't let me use the post method
Expand|Select|Wrap|Line Numbers
  1. <form name="input" action="index2.htm" method="get">
  2. Name: <input type="text" name="user" /> <br />
  3. <input type="radio" name="sex" value="male" /> Male<br />
  4. <input type="radio" name="sex" value="female" /> Female <br />
  5. <input type="checkbox" name="Bike" value="Yes" /> I have a bike<br />
  6. <input type="checkbox" name="Car" value="Yes" /> I have a car <br />
  7. <input type="submit" value="Submit" />
I'd like the site index2.htm to display something like: "Name is a male and has a bike But not a Car
Jan 6 '11 #1
7 2306
Dormilich
8,658 Recognized Expert Moderator Expert
this code should work like that.
Jan 6 '11 #2
AutumnsDecay
170 New Member
You SHOULD be getting something like:

index2.htm?user =username&sex=m ale&bike=I%20ha ve%20a%20bike

Or something similar.

I find it weird that you're unable to post. What version of PHP is the server running?
Jan 6 '11 #3
Spencer Killen
10 New Member
oh my gosh okay it works fine i get a url like
index2.htm?user =username&sex=m ale&bike=I%20ha ve%20 a%20bike
But on that page I want to take those varibles and make a sentence like: Hello bob you are male and you have a car and a bike

Also the post method doesn't work because I have a sub-domain through webs.com and I doesn't allow the post method.
Jan 6 '11 #4
Dormilich
8,658 Recognized Expert Moderator Expert
you can use JavaScript for that. the object of interest is window.location .search
Jan 6 '11 #5
Spencer Killen
10 New Member
ok i managed to find this code
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language="JavaScript">
  4.  
  5. function onload()
  6. {
  7. alert(window.location.search);
  8. }
  9.  
  10. </script>
  11. </head>
  12.  
  13. <body onLoad="onload()">
  14.  
  15. </body>
  16. </html>
  17.  
whats with the "alert" or "onload" do i need them, and if im right this will return them as javascript variables?

I used this code just to test it and it didn't woek
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script language="JavaScript">
  3.  
  4. function onload()
  5. {
  6. alert(window.location.search);
  7. }
  8.  
  9. document.write(sex);
  10.  
  11.  
  12. </script>
  13.  
  14. </head>
  15.  
Jan 7 '11 #6
Dormilich
8,658 Recognized Expert Moderator Expert
window.location .search returns that part of the URI between file address and anchor target. you have to break up that string into the relevant parts. it does not do the break-up automatically.
Jan 7 '11 #7
Spencer Killen
10 New Member
G0T IT
thanks Dormilich

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!--
  3.  
  4. function querySt(ji) {
  5. hu = window.location.search.substring(1);
  6. gy = hu.split("&");
  7. for (i=0;i<gy.length;i++) {
  8. ft = gy[i].split("=");
  9. if (ft[0] == ji) {
  10. return ft[1];
  11. }
  12. }
  13. }
  14.  
  15. var koko = querySt("sex");
  16.  
  17. document.write(koko);
  18. document.write("<br>");
  19. document.write(hu);
  20.  
Jan 7 '11 #8

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

Similar topics

1
1964
by: Matt | last post by:
The following will both post the form data using HTTP POST method to the server2, and then open page2.asp, right? It is not posting form data to server1. The only difference is that #1 will just replace page1.asp with page2.asp. But in #2, it will open a new window for page2.asp, and page1.asp also there. So that means post the form data and...
2
5802
by: Matt | last post by:
I want to post the form data (http://server/page1.asp) to a modal dialog window (http://server/modaldialog.asp) with a desired height 200px by width 200px. Here's my attempts and problems: Attempt #1) In http://server/page1.asp, it has code <form action="http://server/modaldialog.asp" method="post" target="_blank"> In...
2
1859
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the JavaScript: InputForm.action="URL LOCATION" InputForm.method="POST"; I think we don't need InputForm.submit(); because <input type="submit">.
10
19322
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is able to fill that one out just fine. The second form is multipart/form-data. Unfortunately, I haven't been able to fill that out in a way that makes...
1
2777
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the JavaScript: InputForm.action="URL LOCATION" InputForm.method="POST"; I think we don't need InputForm.submit(); because <input type="submit">.
5
1978
by: Peter | last post by:
I have 3 ASP.NET forms written in C#, I also have 3 frames (left, top and bottom) one for each form. My question is if I have data on one form in the bottom frame how do I access this data when I click on the button which is on the top frame? I want to save the data from the bottom frame to the database when a user clicks on the Update button....
4
4568
by: Alex Sibilev | last post by:
Hello, I have a really weird problem I've been trying to solve it without any luck for the last couple of hours :( I'm writing a "conference board" application (quite similar to ASP.NET forum). I don't use server controls in it (apart from Page). The problem occurs on the page where visitor can post a new messages. Basically, it's a...
7
17276
by: Mark Waser | last post by:
Hi all, I'm trying to post multipart/form-data to a web page but seem to have run into a wall. I'm familiar with RFC 1867 and have done this before (with AOLServer and Tcl) but just can't seem to get it to work in Visual Basic. I tried coding it once myself from scratch and then modified a class that I found on a newsgroup (referenced...
1
2062
by: Asaf | last post by:
Hi, I am developing a windows forms client application that will send a large XML data to a web server using Web Services. I saw this article http://www.codeproject.com/soap/MTOMWebServices.asp for uploading files using MTOM. Is there any way to transfer large data from the client to the web server using WSE3 with chunks but instead of...
0
7903
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. ...
0
8115
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
7959
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...
1
5488
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
5216
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...
0
3648
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...
1
2093
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
1
1205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
930
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...

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.