944,198 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3406
  • PHP RSS
Jul 5th, 2005
0

Html+PHP Forms

Expand Post »
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...
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Jul 5th, 2005
0

Re: Html+PHP Forms

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
randallj2877 is offline Offline
8 posts
since Jul 2005
Jul 7th, 2005
0

Re: Html+PHP Forms

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.
Reputation Points: 152
Solved Threads: 39
Master Poster
Killer_Typo is offline Offline
778 posts
since Apr 2004
Jul 8th, 2005
0

Re: Html+PHP Forms

Well that explains it. Thanks I fineally was able to send data to another page.
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Jul 11th, 2005
0

Re: Html+PHP Forms

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:
Reputation Points: 10
Solved Threads: 2
Junior Poster
Electrohead is offline Offline
149 posts
since May 2005
Jul 13th, 2005
0

Re: Html+PHP Forms

Which is the better method? GET or POST?

I particularly like POST because you don't see information being passed in the address...
Reputation Points: 11
Solved Threads: 0
Newbie Poster
bgharper is offline Offline
12 posts
since Jul 2005
Jul 13th, 2005
0

Re: Html+PHP Forms

Quote 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...
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.
Reputation Points: 152
Solved Threads: 39
Master Poster
Killer_Typo is offline Offline
778 posts
since Apr 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: How to stop Php is something does not exist
Next Thread in PHP Forum Timeline: Problem with displaying data..





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC