Html+PHP Forms

Reply

Join Date: Jun 2005
Posts: 147
Reputation: ashneet is an unknown quantity at this point 
Solved Threads: 1
ashneet's Avatar
ashneet ashneet is offline Offline
Junior Poster

Html+PHP Forms

 
0
  #1
Jul 5th, 2005
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...
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 8
Reputation: randallj2877 is an unknown quantity at this point 
Solved Threads: 0
randallj2877 randallj2877 is offline Offline
Newbie Poster

Re: Html+PHP Forms

 
0
  #2
Jul 5th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 759
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Solved Threads: 35
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: Html+PHP Forms

 
0
  #3
Jul 7th, 2005
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.
Dont forget to spread the reputation to those that deserve!
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 147
Reputation: ashneet is an unknown quantity at this point 
Solved Threads: 1
ashneet's Avatar
ashneet ashneet is offline Offline
Junior Poster

Re: Html+PHP Forms

 
0
  #4
Jul 8th, 2005
Well that explains it. Thanks I fineally was able to send data to another page.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 149
Reputation: Electrohead is an unknown quantity at this point 
Solved Threads: 1
Electrohead's Avatar
Electrohead Electrohead is offline Offline
Junior Poster

Re: Html+PHP Forms

 
0
  #5
Jul 11th, 2005
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:
: :: Click here to join my website :: :
Brand new online community! Help my forum grow!
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 12
Reputation: bgharper is an unknown quantity at this point 
Solved Threads: 0
bgharper bgharper is offline Offline
Newbie Poster

Re: Html+PHP Forms

 
0
  #6
Jul 13th, 2005
Which is the better method? GET or POST?

I particularly like POST because you don't see information being passed in the address...
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 759
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Solved Threads: 35
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: Html+PHP Forms

 
0
  #7
Jul 13th, 2005
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.
Dont forget to spread the reputation to those that deserve!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 3207 | Replies: 6
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC