Ask a Question related to PHP Development, Design and Development.
-
John Victor #1
Save variable on a click
I have a menu made up of images where users can click an image to load the
next page. I want each image to send a unique id number to the page the
user loads. Based on this id number, the page that will be loaded will
display something different.
Since I'm not using a form to post data, I decided to save the id number as
a session variable. The loaded page will read the variable when determining
what to load. The problem I'm encountering is where to put the code to get
the first page to save the id number (I know how to save and retrieve
session variables, so that's not an issue).
I've tried putting the php script inside the onclick attribute of the link,
but that didn't work. Does anyone know how I can do this, or know a better
way? Thanks.
--
John Victor
John Victor Guest
-
Set session variable on image click
Hi there guys, Having a problem...I want to set a language session variable when a user clicks on a flag which is in an image map on the index... -
Don't want to right click on a PDF link to save it!!!!
Hi can any one help me to download a .pdf file with out doing save as but just to click on it and it will automatically go to the Save dialog box!!!... -
Save variable value to file from movie...
Hi, I've got a movie where user inputs text and some data. And now i want save it to the disc to a specific folder. How i can do this?? Any help,... -
I need to save a class object in a Session variable. Good? Bad?
Hi, I am in a situation where I am forced into passing a class object around between a bunch of pages. The only way that I can figure out how to... -
on click of a link button should first save the data and then open a new browser
Hi, A page consists of a link button. Clicking this link button should first save data in the database. If the data is saved correctly then it... -
eclipsboi #2
Re: Save variable on a click
On Sun, 01 Aug 2004 07:32:31 GMT, "John Victor" <wiegeabo@pacbell.net>
wrote:
You don't need a form to send data to the server. And sessions are>I have a menu made up of images where users can click an image to load the
>next page. I want each image to send a unique id number to the page the
>user loads. Based on this id number, the page that will be loaded will
>display something different.
>
>Since I'm not using a form to post data, I decided to save the id number as
>a session variable. The loaded page will read the variable when determining
>what to load. The problem I'm encountering is where to put the code to get
>the first page to save the id number (I know how to save and retrieve
>session variables, so that's not an issue).
>
>I've tried putting the php script inside the onclick attribute of the link,
>but that didn't work. Does anyone know how I can do this, or know a better
>way? Thanks.
dealt with solely on server-side. So the problem is, how to tell your
script which image the user clicked on. You can use $_GET: Meaning,
append a ?name=value to the links of your images. Name could be
anything you want the variable to be called, so you can access it via
$_GET['name'] in PHP. Value is some unique identifier to determine
which image was clicked (it could be as simple as the image file name,
or something you concoct yourself).
Remember, the key to writing successful sites is communication: You
have to find viable ways to have your web pages communicate with your
PHP back-end. $_GET and $_POST are the two most popular ways, certain
$_SERVER variables (i.e. PHP_SELF, PATH_INFO, etc) are another way.
Create a file, name it whatever you want, and put the following code
in there to help you see what goes between the browser and PHP:
<?
phpinfo();
?>
Happy coding.
eclipsboi Guest
-
Sebastian Lauwers #3
Re: Save variable on a click
eclipsboi wrote:
Indeed, PHP is server side, so once it's outputted, you can't change the> You don't need a form to send data to the server. And sessions are
> dealt with solely on server-side. So the problem is, how to tell your
> script which image the user clicked on. You can use $_GET: Meaning,
> append a ?name=value to the links of your images. Name could be
> anything you want the variable to be called, so you can access it via
> $_GET['name'] in PHP. Value is some unique identifier to determine
> which image was clicked (it could be as simple as the image file name,
> or something you concoct yourself).
>
> Remember, the key to writing successful sites is communication: You
> have to find viable ways to have your web pages communicate with your
> PHP back-end. $_GET and $_POST are the two most popular ways, certain
> $_SERVER variables (i.e. PHP_SELF, PATH_INFO, etc) are another way.
> Create a file, name it whatever you want, and put the following code
> in there to help you see what goes between the browser and PHP:
>
> <?
> phpinfo();
> ?>
>
> Happy coding.
vars anymore.
You could try to use a database in order to stock the meaning of the
picture's IDs. The big part of the script will of course populating the
database, but it's i think one of the best ways to do so.
HTH,
Sebastian
Sebastian Lauwers Guest



Reply With Quote

