| | |
Html+PHP Forms
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
What i am trying to do is to make a like that sends some info to next page so that PHP could use query for the deta sent.
OK here is how the hyper link looks like and i want it to send some variable to next page:
[HTML]<a href="index.php" onClick="window.open('./Someting.php', 'newwindow', 'height=720,width=520,toolbar=no,menubar=no,scroolbar=no,resizable=no,location=no,directories=no,status=no'); return false;">
Item Description Click Here[/HTML]
any help on how would i send and variable containg the item # to next page...
OK here is how the hyper link looks like and i want it to send some variable to next page:
[HTML]<a href="index.php" onClick="window.open('./Someting.php', 'newwindow', 'height=720,width=520,toolbar=no,menubar=no,scroolbar=no,resizable=no,location=no,directories=no,status=no'); return false;">
Item Description Click Here[/HTML]
any help on how would i send and variable containg the item # to next page...
•
•
Join Date: Jul 2005
Posts: 8
Reputation:
Solved Threads: 0
you need to use the GET method to define variables and send them to another page via a URL. For example:
[HTML]<a href="next_page.php?first_variable=5&second_variable=3" onClick="window.open('http://www.yourdomain.com/next_page.php?first_variable=5&second_variable=3', '', 'height=720,width=520,toolbar=no,menubar=no,scroolbar=no,resizable=no,location=no,directories=no,status=no'); return false;">Item Description Click Here</a>[/HTML]
Your variable assignments come after the ? in the URL and are separated by &'s....
Then, on next_page.php, invoke the following code:
[PHP]$first_variable = $_GET['first_variable'];
$second_variable = $_GET['second_variable'];[/PHP]
Now you have access to your information via the variables $first_variable and $second_variable. You can use the variables in your database query now.
[HTML]<a href="next_page.php?first_variable=5&second_variable=3" onClick="window.open('http://www.yourdomain.com/next_page.php?first_variable=5&second_variable=3', '', 'height=720,width=520,toolbar=no,menubar=no,scroolbar=no,resizable=no,location=no,directories=no,status=no'); return false;">Item Description Click Here</a>[/HTML]
Your variable assignments come after the ? in the URL and are separated by &'s....
Then, on next_page.php, invoke the following code:
[PHP]$first_variable = $_GET['first_variable'];
$second_variable = $_GET['second_variable'];[/PHP]
Now you have access to your information via the variables $first_variable and $second_variable. You can use the variables in your database query now.
read this tutorial that i wrote. It uses PHP/MySQL/HTML-Forms to pass data to another page to run queries on it.
You could probably read through that and get the general idea of how to use forms and such.
You could probably read through that and get the general idea of how to use forms and such.
Dont forget to spread the reputation to those that deserve!
If you are dealing with passwords, you should use the POST method rather than GET, as it will prevent it from displaying in the address bar..
However, for searches or other non-secret inputs you can just use GET
Hope it helps :cheesy:
However, for searches or other non-secret inputs you can just use GET
Hope it helps :cheesy:
•
•
•
•
Originally Posted by bgharper
Which is the better method? GET or POST?
I particularly like POST because you don't see information being passed in the address...
I prefer post because that is what i learned with. but i have much possitive feedback from get too. but for those that wish to build a form to pass things such as passwords, POST is the way to go because it is not passed through the addressbar.
Dont forget to spread the reputation to those that deserve!
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: How to stop Php is something does not exist
- Next Thread: Problem with displaying data..
Views: 3207 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date datepart directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql oop parse password paypal pdf php problem query radio random recursion regex remote script search select seo server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web webdesign xml youtube





