954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Html+PHP Forms

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]
Item Description Click Here[/HTML]
any help on how would i send and variable containg the item # to next page... :cool:

ashneet
Junior Poster
147 posts since Jun 2005
Reputation Points: 10
Solved Threads: 1
 

you need to use the GET method to define variables and send them to another page via a URL. For example:

[HTML]Item Description Click Here[/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.

randallj2877
Newbie Poster
8 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

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.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

Well that explains it. Thanks I fineally was able to send data to another page.

ashneet
Junior Poster
147 posts since Jun 2005
Reputation Points: 10
Solved Threads: 1
 

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:

Electrohead
Junior Poster
150 posts since May 2005
Reputation Points: 10
Solved Threads: 2
 

Which is the better method? GET or POST?

I particularly like POST because you don't see information being passed in the address...

bgharper
Newbie Poster
12 posts since Jul 2005
Reputation Points: 11
Solved Threads: 0
 
Which is the better method? GET or POST? I particularly like POST because you don't see information being passed in the address...



thats a hard question because it depends on the information being passed and the ammount of it.

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.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You