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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bsg
Forum Newbie
Posts: 2
Joined: Tue Oct 31, 2006 4:04 am

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

Post 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
gunman
Forum Newbie
Posts: 10
Joined: Fri Aug 26, 2005 12:07 pm

Answer

Post 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]
bsg
Forum Newbie
Posts: 2
Joined: Tue Oct 31, 2006 4:04 am

Post by bsg »

Chears mate. thanks for your time :D
Post Reply