close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Pass image in Session Variable

Thread began 1/14/2010 10:30 pm by swoodmwood396702 | Last modified 1/19/2010 8:14 pm by Eric Mittman | 1805 views | 9 replies |

swoodmwood396702

Pass image in Session Variable

I'm not using CSS Form Builder, but didn't know where else to put this Thread.
I am having a problem with knowing how to accomplish the following:

I have a Dreamweaver Form. In the form there is a color grid (Radio group with radio buttons). When I select a color (i.e. radio button), I pass the color choice to the next page using a Session Variable and therefore can display the text of the choice (i.e. Black) for the customer to confirm.

<td width="21" bgcolor="#000000"><p class="style4">
<input type="radio" name="BallColor" value="Black" id="Black" />
</td>
<td width="21" bgcolor="#BF202E"><span class="style6">

This is working Great.
The issue is that I ALSO want to pass an image (that I have stored in my server directory) for the same choice (i.e. Black.jpg) but I can't figure it out, so don't know if it's possible. I have to think I could enter some custom code to make it work, but I'm not a programmer, so don't know what to do.

Here's an example of what I tried (remember, I'm not a programmer) and obviously, it didn't work:

<input type="radio" AND "image"src="../Colors/formimages/Black.jpg" name="BallColor" value="Black" id="Black" />

I know a little about working with my database and recordsets and stuff, so maybe you'll recommend a solution using these tools?...

Any help would be greatly appreciated. My hair is starting to fall out : (

Sign in to reply to this post

Eric Mittman

You will not be able to pass the image to the next page this way. When you have an input in a form it is the value that will be posted. You will need some way to associate the image with the selection. Do your images all relate to the choice directly? In your example the value of the radio option was Black, and the image was Black.jpg. You could use the value of the radio selection to show the image on the next page with some code like this:

php:
<img  src="../Colors/formimages/<?php echo $_POST['BallColor'?>.jpg"/>



This is using the posted reference for the variable, you would want to use your session variable that is holding this value in it's place. If all of your options and image names match up like this then this would be one way you can get the image for the selection made to show on the next page.

Sign in to reply to this post

swoodmwood396702

would nominee

Thanks Eric, I'll try it.

I'm wanting to pass the Text value of the color AND an image for the color.

So, if I change the value of BallColor to "Black.jpg", then the user will see "Black.jpg" as the Text description.

Perhaps, I don't need the Text description, maybe I can just show the image of the color instead.

Sign in to reply to this post

Eric Mittman

The key to being able to select one value and show more information about the selection is to associate the corresponding details with the selection that is made. This is something that is much more difficult on a static page where the information only comes from a form or hard coded values. Normally this type of thing would be done with dynamic info from a database.

For example, if you have a table that had records for each choice and that table had columns for the color, the image, and the description you could just set the value of the selection to the id for the record in the db. Then on the next page you would have a recordset that would look up the other corresponding values based on the id that you passed. Having a user make one selection and having multiple values come from this one selection can be tricky without using a database. You could do something similar to the recordset lookup and just have a case statement that depending on the value of the radio option selected other variables can be set to the corresponding values for the image and color.

Sign in to reply to this post

swoodmwood396702

Actual image is not seen

The problem is that I haven't posted anything to my Database yet. I want the customer to confirm their choices, before committing their entries to the database.

So, I'm just spitting back their entries to them with a message to confirm them. Once they confirm, and move to the next step in the process, their choices are committed to the database.

I entered the line of code that you specified earlier:
<img src="../Colors/formimages/<?php echo $_POST['BallColor'] ?>.jpg"/>

The image is getting mapped correctly to the image in my server directory, but I don't see an actual picture. It's a box with a little x in it. I don't think that authorization or permissions is an issue.

I'm also wondering why we're not entering the echo $_SESSION command for this procedure? When I was passing the TEXT value for "BallColor", I would have the code as follows:
<?php echo $_SESSION['BallColor']; ?>

Shouldn't I have to echo the SESSION before telling the page to POST the answer?
Thanks!

Sign in to reply to this post

Eric Mittman

You would use the session variable reference if this value is held in a session variable and is not posted. Without more knowledge of how the pages are set up it is difficult to say what value you should use. Do you have a link to the live page where this can be seen?

Also, when I was making reference to the db I was referring to the choices the user is selecting from, not the choices they are making. For example, if you had a table for the items in your db and you had records that contained the corresponding values you could just reference that record with a recordset and get back all of the info associated with that option.

Like I mentioned, it can be pretty tricky getting more than a single piece of info back from a form with only one value. If you can post back with the pages in question I might have a better idea of what the interaction is and a way for you to get the values you need.

Sign in to reply to this post

swoodmwood396702

Screen shots

This post has been deleted.

swoodmwood396702

reposting screen shots

I attached some screen shots.

Thanks!

Attached Files
ForumPost.doc
Sign in to reply to this post

Eric Mittman

I was not able to view your attachment. Please post back with links to the two pages and include some info about how the pages are supposed to interact and what is not working now that you are trying to get in place. I think with some more info about the pages and the situation I will better be able to help you.

Sign in to reply to this post

swoodmwood396702

Solved

My images were in the correct location (in my dreamweaver folder structure) but not on the actual Server (at Yahoo). Once I loaded the images to the Yahoo folder, I was able to see my image.

Thanks.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...