Link to home
Start Free TrialLog in
Avatar of gtvingo14
gtvingo14Flag for Afghanistan

asked on

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

Avatar of khsater
khsater

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.
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.
Avatar of gtvingo14

ASKER

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.
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']
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" />
You can't transfer the value of a form field into an address and forward the user without javascript.
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.
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.
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

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.
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

Well, I dont have a way to modify the code....
So you want to submit this value on sonebody elses site?
yes.
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?
So what you want to do is submit a post value by submitting a get value to another persons website?
This is not possible.
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.
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.
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...
You should accept both comment #24134165 and #24133961 as partial solutions.
Why should I accept? You did not provide any partial answers...will wait for someone who knows this area
You are not offering enough detail for us to provide a solution
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.
- 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.
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?
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.
ASKER CERTIFIED SOLUTION
Avatar of mstrelan
mstrelan
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of Michel Plungjan
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

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That was what I was looking for, thanks I will try it in the morning.
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.