473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

session value and radio button

On one page I have radio buttons below pictures, here is one picture...

<img src="images/web-aroundworld458c.jpg" width="100" height="51"
border="0"
onclick="this.src='./images/web-aroundworld458c.jpg';this.height=102;this.width=20 0"
ondblclick="this.src='./images/web-aroundworld458c.jpg';this.height=51;this.width=100 "
alt="" /><br />
<input type="radio" name="image_choice" value="lp15-web-aroundworld458c"
style="width: 35px;"/>LP-15<br />

....then I have a link to a page in which if a radio button is chosen, a
value will be passed to the new page.

<?php
$_SESSION['image_choice']=image_choice;
?>

The theory works but what is passed is the wording "image_choice" and not
what I expected...."lp15-web-aroundworld458c".

If the value of image_choice is "lp15-web-aroundworld458c", then why would
it return the literal "image_choice"?
How can I get the value of the button to go to the new page?

Also, does session_start(); need to be on each php page when passing the
values between pages?

Thanks,
Thad
Mar 31 '07 #1
3 3950
On 31 Mar, 23:36, "Thad" <tsob...@cox.netwrote:
On one page I have radio buttons below pictures, here is one picture...

<img src="images/web-aroundworld458c.jpg" width="100" height="51"
border="0"
onclick="this.src='./images/web-aroundworld458c.jpg';this.height=102;this.width=20 0"
ondblclick="this.src='./images/web-aroundworld458c.jpg';this.height=51;this.width=100 "
alt="" /><br />
<input type="radio" name="image_choice" value="lp15-web-aroundworld458c"
style="width: 35px;"/>LP-15<br />

...then I have a link to a page in which if a radio button is chosen, a
value will be passed to the new page.

<?php
$_SESSION['image_choice']=image_choice;
?>

The theory works but what is passed is the wording "image_choice" and not
what I expected...."lp15-web-aroundworld458c".

If the value of image_choice is "lp15-web-aroundworld458c", then why would
it return the literal "image_choice"?
How can I get the value of the button to go to the new page?

Also, does session_start(); need to be on each php page when passing the
values between pages?

Thanks,
Thad
Advice: be clearer about what your code is, don't say "I've got this
and that code", just show us

Firstly yes session_start needs to be whereever you wish to use the
session - see http://uk.php.net/session_start
and secondly
what is this expected to do?

<?php
$_SESSION['image_choice']=image_choice;
?>

don't you mean
<?php
$_SESSION['image_choice']=$image_choice;
?>

where $image_choice is what you sent, either $_GET['image_choice'] or
$_POST['image_choice']
but you havent actually given enough code to help us help you.

Mar 31 '07 #2
I will try this worded different...

HTML page 1: I have two radio buttons...
<?php session_start(); ?>
<input type="radio" name="image_choice" value="lp13-web-wild165c"
style="width: 35px;"/>LP-13<br />
<input type="radio" name="image_choice" value="lp14-web-wild289c"
style="width: 35px;"/>LP-14<br />

HTML page 2: Problem...on html page 2, how would I show which button was
pressed?

Would it be....
<?php session_start();
echo $_SESSION['image_choice'];
?>

What I am looking to get as a result is lp13-web-wild165c or
lp14-web-wild289c to be printed to the screen.
Mar 31 '07 #3
In article <5x********************@newsfe08.phx>, ts*****@cox.net says...
I will try this worded different...

HTML page 1: I have two radio buttons...
<?php session_start(); ?>
<input type="radio" name="image_choice" value="lp13-web-wild165c"
style="width: 35px;"/>LP-13<br />
<input type="radio" name="image_choice" value="lp14-web-wild289c"
style="width: 35px;"/>LP-14<br />

HTML page 2: Problem...on html page 2, how would I show which button was
pressed?

Would it be....
<?php session_start();
echo $_SESSION['image_choice'];
?>
If your form method is POST
use
echo $_POST['image_choice'];
If your form method is GET
use
echo $_GET['image_choice'];
Sessions aren't really relevant to your problem.

Andy
Apr 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Randell D. | last post by:
Folks, I have a form (called FORM1) - In my INPUT submit tag, I have an onClick event that I have successfully tested/used to display the value of a TEXT box using the following function (called...
2
by: jason | last post by:
The following (likely far from imperfect code), reports a value of NaN in the j4 display. I suppose the problem is I am not really passing the "checked" value of the radio button via .value ......
4
by: mitch-co2 | last post by:
What I am trying to do is when someone clicks on the YES radio button I want the text field called MYTEXT to equal the text field named DATE. The below code works as long as I do NOT UN-COMMENT...
1
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with...
3
by: itissandeep | last post by:
I have a simple application that has a map. The user has to select two sets from a single type of feature from the map. I use two radio buttons under same GroupName for each set. When the page...
2
by: Mirovk | last post by:
Hi, I have a session variable wich value arrives from a previous .asp but in my actual page I need to modify it based upon a selected value from a radio button. I will try to figure out for...
5
by: Mirovk | last post by:
The onclick action associated to my form´s radio buttons call to a vbscript were the session values are changed, this happens correctly but with the onclick action associated to my continue button...
1
by: zwieback89 | last post by:
Hi, I have a org tree with hierarchical display of employees built using classic asp and vbscript. I also have list of radio buttons for report names. I have 1 select box with dates in it....
1
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.