Copy link to clipboard
Copied
I am working with Dreamweaver- MySql-PHP-Apache-windows vista 32 bit
I have a table called cars with 3 columns (id, name, year). I want to use checkboxes to select which columns to display. For example I have 3 checkboxes id, name, year. If I select the checkboxes for id and name I should be able to display only id and name for all records.
I tried the adobe tutorial (http://kb2.adobe.com/cps/165/tn_16563.html) to use session variables to display the text on an other page. There was no error but when I entered text on the first page it did not display on the second page. I had thought that using session variables with checkboxes I would be able to retieve selected columns from MySql database.
Please suggest why the session variables tutorial did not work and whether I can use session variables to solve the problem of retrieving selected data using checkboxes.
Thank you very much.
Copy link to clipboard
Copied
One reason it probably didn't work is because the information on that page is way out of date, at least for PHP. It does say "Archived" at the top of the page, indicating that it's no longer actively updated.
To create session variables in PHP these days, begin the page with session_start(). Then assign the values directly to the $_SESSION superglobal array.
<?php
session_start();
$_SESSION['name'] = 'David';
?>
On any subsequent page that begins with session_start(), $_SESSION['name'] will have the value "David".
Copy link to clipboard
Copied
Thank you David.
I was able to display a regular variable such as name on a second page using the session variable from your code. However I am not able to display the value of the checkbox variable on the second page. My final goal is to use the checkbox variable to display a particular selection from the database table.
For example, in a table (cars) which has names "bmw,audi,toyota" I want to retrieve the records for bmw only by selecting the bmw checkbox while leaving the remaining two unselected.
In Dreamweaver I named my checkbox id as "ch1" and I also entered 'yes' for the checked value. I was not able to print the value of the checkbox variable on a second page using the session variable.
I also tried to print a text on a second page using the session variable by entering the text into a text box on the first page . It seems that I am not able to correctly assign the testbox variable to the session variable. I have the same problem with the checkbox.
Thank You very much for your help
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more