![]() |
Turning a 'submit' button into a URL?
Is it possible to take a forms submit button and code it so that it acts like a url.
I do not think and 'onclick' element will actually work for what I need :/ I want to avoid using the form itself but still need it (data collection) and wanted to simply add a meta refresh to a page as if the button was clicked. Nothing nefarious, just want the form to still count submit clicks in the database, without having to have the surfer click the submit button. This is the form I'm using presently: Quote:
|
If the surfer isn't clicking submit then what submit clicks are you counting?
|
Maybe something like:
Give the form a name, for example "form1", then Code:
window.onload = function(){ Code:
<body onload="document.form1.submit()"> |
So the question isn't how to turn a button into a URL (which I'm sure he's asked before) but how to make a form automatically submit on page load?
|
Quote:
Onclick wont work for this, I need to be able to change a submit button to a clickable link (the link from the previous page loads the form, but i want to bypass the form but still carry the data through to the 3rd page). |
Is the 3rd page on your site?
|
Quote:
<form action="page3.php" method="post"> Message: <input type="text" name="message"> Name: <input type="text" name="name"> Email address: <input type="text" name="emailad"> <input type="submit"> </form> page3.php: <html> <body> Hello <?php echo $_POST["name"]; ?>, I see that you wrote <?php echo $_POST["message"]; ?><br> Your email address is <?php echo $_POST["emailad"]; ?> </body> </html> This carries data to another page and doesn't need it to be a clickable link |
Quote:
Is that what you're trying to do? |
Quote:
Otherwise I'll have a redirect page with a form on it that I'll have to throw ads on before going to the tagret url which will detract from the surfers site experience. |
Quote:
|
I think I read something wrong lol.
But, if you want to send data on a <a href=...> then sessions would work. But, if you want to send that data to other sites, then that makes things kind of tricky, like syncing up where the sessions are stored on both sites. Also, probably will have to use a prefix for the session variables on each site so that they aren't named the same and cause issues etc. |
Quote:
If you want to move the visitor from one page to another, while at the same time, invoking a script using the form data from the first page, you might be able to achieve that by passing the data to the next page and coding the next page to recognize the passed form data, invoking a web hit to whatever script is handling the form data. Do you have coding control of the target page, or is that a third party page? |
Quote:
How are you handling the form data? With a PHP script and some DB hit? |
Quote:
Once its completed theres a very high chance you might be interested in this script too ;) Send me a PM :) |
How about this...
Your page with the form, on submit, executes a PHP script: record_and_go.php You pass whatever data you need for saving, AND the target URL. The PHP script does whatever DB validation/update you need, and returns an tiny HTML shell that contains only a Javascript snippet that immediately sets the window location (page url) to the target page from the last form. That will cause the target page to be loaded when the JS is executed (on form load). ?? |
Quote:
I'd need to add an additional .php file, but yeah, I can see that working. |
Quote:
|
Quote:
As I now understand, the application is more for top list / traffic exchange tracking. |
I'm trying to understand the question, but I have no idea what OP is trying to achieve =D
Can you please describe your question step by step? There are many good answers above, but I still have no idea what you need :D You have a form, which, in this case is completely unnecessary.. You can simply use 2 links without the form itself.. |
Seems like he wants to use the visitor's IP and browser, to submit a form in an external site.
First check if they have CSRF tokens, a validation that their site is not in an iFrame, CloudFront, or any other security measures. Then it may be achievable with JavaScript as well. |
Quote:
Quote:
The only thing he has been clear about is wanting to generate clicks that people haven't made. |
Quote:
|
Even simpler solution.
Use a PHP script that scrapes the form data (for DB) and the target URL. When PHP updates the DB, simply return a location header from the PHP script, aimed at the target URL. |
All times are GMT -7. The time now is 03:04 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc