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
https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/
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"

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....

 

 

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'];?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.