Page 1 of 1

Probably a very simple thing to do but i cant figure it out

Posted: Tue Oct 31, 2006 5:27 am
by bsg
what i basicly need is the code to send information in a <form> from one php to another.

im generating a table of images from a database that i intend to have users click on that will open another php and depending on the image that they selected the php will have different information on it. every image will open the same php file but the information will be different depending on what information was passed from the previous php through clicking the image

so how do i pass the information to the next page by using a picture link?

idealy i would like to use the html tag <form> so that the url can be used to link to the generated page but dont know the code for making the information past on to the next php.

i realise this is probably possible by java script but would pefer not to use java script. I will use it if absolutly nessary but would pefer to stick with standard php and html tags and sql

Answer

Posted: Tue Oct 31, 2006 5:59 am
by gunman
As you said it is not difficult imagine that you already have a php file called "main.php" with images in form something like that


main.php

Code: Select all

<form name = "ff1" method="post" action="./main.php">
<img src="image1" onclick="document.ff1.submit();">
</form>
<form name = "ff2" method="post" action="./main.php">
<img src="image2" onclick="document.ff2.submit();">
</form>
.....
In this form when click on a image then it post information to main.php again and you could add to main.php code where to perform necessary operation to your purpose


main.php

Code: Select all

<?
if (strtolower($_SERVER['REQUEST_METHOD']) == "post")
{
   //do whatever you want
}
?>
[/quote]

Posted: Tue Oct 31, 2006 6:07 am
by bsg
Chears mate. thanks for your time :D