Jump to content

Recommended Posts

When I try this:

 

<?php
                    $item_selected_style = $_GET['item_selected_style'];


                    echo "Garment Style:";
                    <SELECT NAME=custom10 SIZE=1>;
                    echo 
                    "<OPTION SELECTED="SELECTED" VALUE="$item_selected_style">"$item_selected_style"</OPTION>
                    <OPTION VALUE="Goucho Pants w/Elastic Waist">Goucho Pants w/Elastic Waist</OPTION>
                    <OPTION VALUE="Goucho Pants w/Draw String">Goucho Pants w/Draw String</OPTION>
                    <OPTION VALUE="Poncho w/Hood">Poncho w/Hood</OPTION>
                    <OPTION VALUE="Poncho without Hood">Poncho without Hood</OPTION>
                    <OPTION VALUE="Baby Bunting">Baby Bunting</OPTION>
                    <OPTION VALUE="Romper">Romper</OPTION>";
                    </SELECT><BR>;
                    ?>

 

It does NOT work.  I get the following error:

 

Parse error: syntax error, unexpected '<' in /homepages/27/d120150310/htdocs/poj/poj_order_form.php on line 69

 

Can one or more of you phpFreaks help please?

 

Thank you!

                    ;

 

This is not pure PHP code.  You have to echo it out like the rest of the HTML.  And use single quotes around attribute values, or else it things you're ending the string.  The PHP vars will still interpolate.

  • 3 weeks later...

Thank you so much for all of your help!

 

The MAIN thing I need help with at this point is a php script that when I pass the value of  '$item_selected_color', it will do the following: display the passed value of '$item_selected_color' as the initial SELECTED value in the dropdown list AND displaying the the image of the SELECTED value. The user can select a different color from the dropdown list and when he does, the image will change displaying an image of the users newly selected choice of color.

 

I am doing something similar to that now with the following code(JS, HTML and php), but it does not GET the '$item_selected_color' value and therefore does not put the desired initial SELECTED value in the dropdown list and/or does not display the correct image:

 

		 <SCRIPT LANGUAGE="javascript">

         GarmentColorArray = new Array (;

            GarmentColorArray[1] = "POJ00215.jpg";

            GarmentColorArray[2] = "POJ00216.jpg";

            GarmentColorArray[3] = "POJ00217.jpg";

            GarmentColorArray[4] = "POJ00218.jpg";

            GarmentColorArray[5] = "POJ00219.jpg";

            GarmentColorArray[6] = "POJ00220.jpg";

            GarmentColorArray[7] = "POJ00221.jpg";

            GarmentColorArray[8] = "POJ00222.jpg";

            function GarmentColorImageSwap(imgBase,imgIndex)
             {
            Index = imgIndex + 1;
            document.GarmentColorImage.src = '/images/thumbs/' +
               GarmentColorArray[index];
             }

			</SCRIPT>

            <!-- Garment Color = custom20-->
			<SELECT NAME="custom20"
			 ONCHANGE="GarmentColorImageSwap('GarmentColorImage', this.selectedIndex)" SIZE="1">
				<OPTION  SELECTED="SELECTED" VALUE="test">test</OPTION>
				<OPTION VALUE="Color: RED Hibiscus">RED Hibiscus</OPTION>
				<OPTION VALUE="Color: Dark Blue Hibiscus">Dark Blue Hibiscus</OPTION>
				<OPTION VALUE="Color: Turquoise Hibiscus">Turquoise Hibiscus</OPTION>
				<OPTION VALUE="Color: Purple Hibiscus">Purple Hibiscus</OPTION>
				<OPTION VALUE="Color: White">White</OPTION>
				<OPTION VALUE="Color: American Flag">American Flag</OPTION>
				<OPTION VALUE="Color: Hundred Dollar Bill">Hundred Dollar Bill</OPTION>
			</SELECT>

 

I would like to do something similar with a php script bypassing the JavaScript, IF POSSIBLE.  Any ideas?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.