Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

Post HTML Value without clicking the link?

I want to be able to enter a line such as:

http://www.testsite.com/yyy/yyy and I want to post an acount of ### without clicking on the link?

Such as http://www.testsite.com/yyy/yyy?value="###"    

Anyone any other ideas?

Thanks

<form action="/yyy/yyy" method="post">
			Deposit: <input id="yyy_amount" name="yyy_amount" type="text" /yyy/yyy /> <input name="commit" type="submit" value="yyy Amount" />

Open in new window

0
gtvingo14
Asked:
gtvingo14
  • 14
  • 12
  • 3
  • +1
2 Solutions
 
khsaterCommented:
You want to submit a post without clicking on a submit button?  You can do this on FF for sure, and IE under certain conditions: http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter.  If you want to submit information without any user action, you'll need to use JavaScript.
0
 
mstrelanCommented:
Do you understand the difference between $_GET and $_POST ?

The POST array contains values submitted via a form with method="post" whereas the GET array contains values in the URL string eg ?var1=someValue&var2=someValue

Or you can change the form method to method="get" and the values will show up in the URL, which can lead to security issues.

Does this help? I can explain more if you like.
0
 
gtvingo14Author Commented:
Well, what i need is to enter a website in the address bar such as the one shown above and submit number 10.

http://www.testsite.com/yyy/yyy?value="10"

I am just not sure about the right syntax of doing this, it must be very simple.
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
mstrelanCommented:
What server side language are you using? PHP?
If the url reads http://www.testsite.com/yyy/?yyy=10 then you can output the value of yyy by writing
<?php echo($_GET['yyy']); ?>

The question mark indicates the start of a list of variables. then comes the variable name. then equals. then the value. eg.

www.google.com?q=Lorem+ipsum

variable name is q, value is Lorem ipsum. access it with $_GET['q']
0
 
gtvingo14Author Commented:
Hello, thanks for your help.

I am not looking to find a value of anything, I just want to enter 10 in post.

so far, this is what I am thinking....

http://www.testsite.com/yyy/yyy?yyy_amount="10"

from code of:


<form action="/yyy/yyy" method="post">
                  Deposit: <input id="yyy_amount" name="yyy_amount" type="text" /yyy/yyy /> <input name="commit" type="submit" value="yyy Amount" />
0
 
khsaterCommented:
You can't transfer the value of a form field into an address and forward the user without javascript.
0
 
mstrelanCommented:
Sorry I'm having trouble understanding what you want to do. Let me know if this is correct.

You want to type in the address bar http://www.testsite.com/yyy/yyy?yyy_amount=10
Then you have a form with an input field called yyy_amount. Then you want to put the number 10 that you've got from the address bar in to that input field.
0
 
gtvingo14Author Commented:
mstrelan, yes you have the right idea, but I dont want to just put it into the field, I want to submit it...

khsater, what would be my fast and easy alternative, this is not a critical task, but I just assumed it would not be complicated.
0
 
mstrelanCommented:
It will be submitted when you hit the Submit button.
<form action="/yyy/yyy" method="post">
    <input name="yyy_value" id="yyy_value" value="<?php echo($_GET['yyy_value']);" />
    <input type="submit" value="Submit!" />
</form>

Open in new window

0
 
gtvingo14Author Commented:
Ok, I guess my question if there is any way around clicking on the link of a button?

do I need to write a script to do this? there has to be a way of doing it...and an easy one.
0
 
mstrelanCommented:
when do you want it to submit? as soon as you type in the value?
try this

<form action="/yyy/yyy" method="post">
    <input name="yyy_value" id="yyy_value" value="<?php echo($_GET['yyy_value']);" onblur="if(!isNaN(this.value)) { this.form.submit(); }" />
    <input type="submit" value="Submit!" />
</form>

Open in new window

0
 
gtvingo14Author Commented:
Well, I dont have a way to modify the code....
0
 
mstrelanCommented:
So you want to submit this value on sonebody elses site?
0
 
gtvingo14Author Commented:
yes.
0
 
mstrelanCommented:
That doesn't sound like a good thing. If they want you to be able to do it they will provide you with access to do it. If their server is not very secure submitting values that aren't expected can corrupt their databases and applications. But that's not saying its not possible to do. Do you use Firefox?
0
 
khsaterCommented:
So what you want to do is submit a post value by submitting a get value to another persons website?
This is not possible.
0
 
gtvingo14Author Commented:
khsater, you are dismissed from this question.

This is not a complicated process, I am not trying to get a GET value, I am just trying to POST a value.

Same as me clicking on the button, I just dont want to scroll each time through 2000 lines of website.
0
 
mstrelanCommented:
I can't help any further without knowing the specifics of the website you want to post to. I hope you are not trying to spam the website with hundreds of posts.
0
 
gtvingo14Author Commented:
I just love when first reaction that I get is you are trying to do something malicious.

If I was trying to do anything malicious, I would have a little more knowledge than asking how to post a value...I guess I will play a bit with syntax, but this is not worth more than 15 minutes of my time which I have already spent...Was just an idea to help in my daily functions...
0
 
mstrelanCommented:
You should accept both comment #24134165 and #24133961 as partial solutions.
0
 
gtvingo14Author Commented:
Why should I accept? You did not provide any partial answers...will wait for someone who knows this area
0
 
mstrelanCommented:
You are not offering enough detail for us to provide a solution
0
 
gtvingo14Author Commented:
Well detail do you NEED? and why are you asking to accept without providing a solution, this is unprofessional and unfair to other experts who actually provide solutions on this site.
0
 
mstrelanCommented:
- Are there any other fields that need to be filled out before the form is posted or do you just want to post the value "10" in the one field and thats it.

- What is the "action" value of the form?

- What is the "method" of the form?

Or better yet just provide the url this form is on.
0
 
gtvingo14Author Commented:
this websites requires login to post, which obviously I cannot provide.

The form has 100s of variables, drop downs, text fields....but everything is optional.

All I need to do is submit number 10 for specific variable. "id="yyy_value"

I dont need to do anything else, I dont need to reload, I dont need to get, I dont need anything crazy.

You dont understand what the action or method which I am trying to do here?
0
 
gtvingo14Author Commented:
mstrelan, please dont waste anymore of your time, looks like you are not getting anywhere. I will just wait for someone who knows this area a little better.
0
 
mstrelanCommented:
suit yourself. you are very rude.

If the server accepts &yyy_value=10 in the url then all you have to do is append that to the url string and hit enter. but it depends if it looks for GET values or only POST values. if its the latter you will need to use a firefox extension to submit post values or build your own form which posts to the same action="...". but then if the server is at all secure it will ensure that the referrer is on its server.

good luck finding help from someone else
0
 
gtvingo14Author Commented:
mstrelan, I have provided you with all of the information you have asked for, and instead of trying to figure out a solution you are thinking what is this for? I am sorry but accusing someone of trying to do anything malicious is not very polite on your end.

When I joined here in 2002, this site was about helping each other and figuring out solutions to the problems and thinking regarding code and not accusing each other of wrong doing. I am obviously not going to be giving out secrets of my business or what I do, there are privacy aspects you also have to consider.

If you can't or won't help, there are others here who are willing to help. And By the way I have helped much more than you have and I have not asked anyone to accept unanswered questions like you have.

Your last idea did not work.
0
 
Michel PlungjanIT ExpertCommented:
Can you not load this page from your hard disc

Since there is only one field, the submit button is optional

If you add a target="_blank" to the form tag, the submission will open in a new window.





<html>
  <head>
  <title></title>
  </head>
  <body onLoad="document.forms[0].elements[0].focus();document.forms[0].elements[0].select()">
<form action="http://www.testsite.com/yyy/yyy" method="post">
Deposit: <input id="yyy_amount" name="yyy_amount" type="text" /> 
<input name="commit" type="submit" value="yyy Amount" />
</form>
  </body>
</html>

Open in new window

0
 
Michel PlungjanIT ExpertCommented:
If you save the page on your server, you can do this:

http://www.yourserver.com/autopost.html?1234234

<html>
  <head>
  <title></title>
  </head>
  <body onLoad="document.forms[0].elements[0].value=location.search.substring(1);document.forms[0].submit()">
<form action="http://www.testsite.com/yyy/yyy" method="post">
Deposit: <input id="yyy_amount" name="yyy_amount" type="text" /> 
</form>
  </body>
</html>

Open in new window

0
 
gtvingo14Author Commented:
That was what I was looking for, thanks I will try it in the morning.
0
 
Michel PlungjanIT ExpertCommented:
PS: The last comment from mstrelan
"build your own form which posts to the same action="...". but then if the server is at all secure it will ensure that the referrer is on its server."

is correct. So what I posted is just that, your own version of the form. And if they test the referrer or a session, then the submission from an external page will be ignored.
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 14
  • 12
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now