wmguk Posted March 10, 2008 Share Posted March 10, 2008 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 More sharing options...
MadTechie Posted March 10, 2008 Share Posted March 10, 2008 i'm not sure what your asking.. Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-488649 Share on other sites More sharing options...
wmguk Posted March 10, 2008 Author Share Posted March 10, 2008 i'm not sure what your asking.. Sorry, basically I mean i need to make <?php echo $row['descr'];?> give the result of <?php echo $row['descr'+'type'];?> so the result is 8 x 6 - Colour Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-488660 Share on other sites More sharing options...
MadTechie Posted March 10, 2008 Share Posted March 10, 2008 you still lost me <?php echo $row['descr'.'type']; ?> <?php $avar = "descrtype"; echo $row[$avar]; ?> Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-488689 Share on other sites More sharing options...
wmguk Posted March 10, 2008 Author Share Posted March 10, 2008 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 https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-488719 Share on other sites More sharing options...
MadTechie Posted March 10, 2008 Share Posted March 10, 2008 so <?php echo $row['descr'].$row['type'];?> ??? or am i still missing it ? Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-488725 Share on other sites More sharing options...
wmguk Posted March 10, 2008 Author Share Posted March 10, 2008 the only issue is that doesnt work, that is what i thought it would look like, but the "type" section just isnt shown Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-488746 Share on other sites More sharing options...
MadTechie Posted March 10, 2008 Share Posted March 10, 2008 you must have a field in the database called type and part of the sql select statement (or use * for all) Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-488775 Share on other sites More sharing options...
wmguk Posted March 10, 2008 Author Share Posted March 10, 2008 thats the problem, its not generated from the database, its a select dropdown on the page.... nothing to do with the database, i want to add to the description thats added to the database. Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-488801 Share on other sites More sharing options...
MadTechie Posted March 11, 2008 Share Posted March 11, 2008 i want to add to the description thats added to the database. Huh.. ??? Okay your need to re-explain what your attemping to do.. start from the end.. whats the goal ? Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-489025 Share on other sites More sharing options...
wmguk Posted March 11, 2008 Author Share Posted March 11, 2008 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 https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-489072 Share on other sites More sharing options...
MadTechie Posted March 11, 2008 Share Posted March 11, 2008 was reading and all was find until this make descr become 8 x 4 - Colour still doesn't make sense! explain with more words! Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-489077 Share on other sites More sharing options...
MadTechie Posted March 11, 2008 Share Posted March 11, 2008 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 https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-489079 Share on other sites More sharing options...
wmguk Posted March 11, 2008 Author Share Posted March 11, 2008 yes yes yes!!! !!!!! Yes, you got it!!!! so simple now i see it!!!! time for me to grab a coffee too thank you for putting up with my appalling descriptions!! Link to comment https://forums.phpfreaks.com/topic/95445-help-adding-a-variable-to-existing-code/#findComment-489092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.