Jump to content

Help adding a variable to existing code?


wmguk

Recommended Posts

Hey,

 

 
<tr>
<td width="232" align="left"><span class=formnames><?php echo $row['descr'];?>      
     <select name="type" id="type" STYLE="background-color:#ffffff;border:0;font-weight:bold;color:#666666;">
     <option value="Colour">Colour</option>
     <option value="B&W">B & W</option>
     <option value="Sepia">Sepia</option>
   </select>
</span></td>
<td align="center"><span class=formnames><?php echo $row['price'];?></span></td>
<td align="center"><input name="addbox" type="button" value=" + " onclick="Item('<?php echo $row['refnum'];?>','<?php echo $row['price'];?>','<?php echo $row['descr'];?>','<?php echo $Pic_Name1;?>','add')"> <input type="button" name="subbox" value="  - " onclick="Item('<?php echo $row['refnum'];?>','<?php echo $row['price'];?>','<?php echo $row['descr'];?>','<?php echo $Pic_Name1;?>','delete')"> <span class=formnames><strong><input type="text" name="<?php echo $row['refnum'];?>" value="None" size="4" readonly STYLE="background-color:#ffffff;border:0;font-weight:bold;color:#666666;"></strong> Selected</span></td>
</tr>

 

what i need to do is add the value of "type" to the

<?php echo $row['descr'];?> 

section

 

any thoughts?

Link to comment
Share on other sites

ok, urm, at the moment the description says "8 x 6" and I have added a drop down box called "type" with the options of Colour, B&W and Sepia..

 

so if i select colour, it would need to show "8 x 6 - Colour"

 

so, this

<?php echo $row['descr'];?>

just shows "8 x 6"

and im trying to amend the info to something like 'descr' - 'type' and display "8 x 6 - Colour"

Link to comment
Share on other sites

sorry, scrub everything said earlier... lets start over.

 

I have a database with 2 rows.

 

8 x 4  |  8.00

9 x 5  |  9.00

 

this information is pulled from the product database and displayed on a page.

 

<?php echo $row['descr'];?>

    <select name="type" class="formnames" id="type" style="color:#999999">

    <option selected="selected" value="Colour">Colour</option>

    <option value="B&W">B & W</option>

    <option value="Sepia">Sepia</option>

  </select>

<? echo $symbol ;?><?php echo $row['price'];?>

 

(Displaying "8 x 4 XXXX £8.00") the XXXX is the drop down box.

 

what i need to do is make descr become 8 x 4 - Colour - this is then inserted in to a totally different order database....

 

 

Link to comment
Share on other sites

Okay.. just had a thought while making my coffee..

 

do you mean you wish to append the field descr to the selection thats submitted

so the post will be for example "8 x 4 Colour" (thats all i can think of)

 

if so try

 

<?php echo $row['descr'];?>
     <select name="type" class="formnames" id="type" style="color:#999999">
     <option selected="selected" value="<?php echo $row['descr'];?> Colour">Colour</option>
     <option value="<?php echo $row['descr'];?> B&W">B & W</option>
     <option value="<?php echo $row['descr'];?> Sepia">Sepia</option>
   </select>
<?php echo $symbol ;?><?php echo $row['price'];?>

Link to comment
Share on other sites

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.