| | |
HYPERLINK with PHP POST
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Hello all
what i am really trying to do is to use POST method to send info to next page with just HYPERLINK; Here is what i want:
Get method:
I want this to be in POST method without using forms.
also i am making this in php so is there a way to do this on click instead of using fourms because i really dont want to use those boxs with submit in them to submit the info.
what i am really trying to do is to use POST method to send info to next page with just HYPERLINK; Here is what i want:
Get method:
PHP Syntax (Toggle Plain Text)
<a href="http://www.someting.com?date=9/15/05&age=21">age and time</a>
also i am making this in php so is there a way to do this on click instead of using fourms because i really dont want to use those boxs with submit in them to submit the info.
I think you have some confusion about a normal url, a get form and and post form
a url such as index.php?page=whatever simulates the results of this get form
If the method was post you wouldn't see the variables on the page (exception in the exception where the action is 'index.php?page=whatever' but that's not recommended).
The intention of post forms is twofold
Sarah
a url such as index.php?page=whatever simulates the results of this get form
PHP Syntax (Toggle Plain Text)
<form action='index.php' method='get'> <input type='text' name='page' value='whatever' /> <input type='submit'> </form>
If the method was post you wouldn't see the variables on the page (exception in the exception where the action is 'index.php?page=whatever' but that's not recommended).
The intention of post forms is twofold
- to allow large amounts of data to be submitted, exceeding the 256 char limit on a url
- to prevent the user from saving the form data as a bookmark and running again later. This is appropriate in a great many cases
Sarah
ok mainly what i want to do is to use the POST method without using forms only because i dont what the HTML button box there:
[HTML]
<input type='text' name='page' value='whatever' />
[/HTML]
I just want to use a plain link or an image instead that input box.
I can use forms but i just dont want to use the input boxes to submit info.
[HTML]
<input type='text' name='page' value='whatever' />
[/HTML]
I just want to use a plain link or an image instead that input box.
I can use forms but i just dont want to use the input boxes to submit info.
I guess you could create a form that uses POST and has no visible elements (use hidden inputs). A hyperlink could then use javascript to submit the form. It's not extremely compatible with older browsers, but it could work if you absolutely had to have it work that way.
Did we help you? Did we miss the point entirely? Update your thread and let us know.
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Here's an example from Chris' suggestion
PHP Syntax (Toggle Plain Text)
<html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <title>Submit Form example from sarahk.pcpropertymanager.com/blog/submit-form-using-javascript/192/</title> <script>function submitMe() { alert('In submitMe()'); document.submitForm.submit(); return; } </script> </head> <body bgcolor="#ffffff"> <form name="submitForm" action="selfsubmit.html" method="post"> <input type="hidden" value="page" name="whatever"> <a href="javascript:document.submitForm.submit()">submit direct</a><br> <a href="javascript:submitMe()">submit via a function</a><br> <input type="image" src="https://scgi.ebay.com/saw/pics/sitewide/processBar1_16x16.gif"> </form> </body> </html>
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
So, in fact you DO want to POST a FORM, you just don't want an "ugly button". Right? Then either style the button using CSS, or code almost any other HTML element, such as a hyperlink, to fire the form's "submit()" method.
(You might have had more answers, sooner, if you'd posted in the HTML/JavaScript forum rather than PHP.)
(You might have had more answers, sooner, if you'd posted in the HTML/JavaScript forum rather than PHP.)
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
It's very simple. If you have a single form on the page, then this hyperlink would submit it:
There are a couple of variations. I prefer to refer to all HTML elements via their ID property. So if you give your form an ID, like:
then your hyperlink could be:
Lastly, if you don't like having that href, you can also code it:
PHP Syntax (Toggle Plain Text)
<a href="#" onclick="document.forms[0].submit();">Submit form</a>
There are a couple of variations. I prefer to refer to all HTML elements via their ID property. So if you give your form an ID, like:
PHP Syntax (Toggle Plain Text)
<form id="myForm" method="post" action="myFormProcessor.php">
then your hyperlink could be:
PHP Syntax (Toggle Plain Text)
<a href="#" onclick="document.getElementById('myForm').submit();">Submit form</a>
Lastly, if you don't like having that href, you can also code it:
PHP Syntax (Toggle Plain Text)
<a href="javascript:document.forms[0].submit();">Submit form</a>
i hope u are looking for this script.
<a href=details.php?id=<?echo $id?>&city=<?echo $city?>&state=<?echo $state?>>click here</a>
u will go to details.php and get all the i nformation of that particular id.
and without using forms and submit button u will go to details .php
i have used state city ext u change the variables.
<a href=details.php?id=<?echo $id?>&city=<?echo $city?>&state=<?echo $state?>>click here</a>
u will go to details.php and get all the i nformation of that particular id.
and without using forms and submit button u will go to details .php
i have used state city ext u change the variables.
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: How to display TIFF file on web page?
- Next Thread: numbering the pages
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube






