piskie Posted September 29, 2006 Share Posted September 29, 2006 I am storing product details in a MYSQL Table.This is to hold Multiple Merchants each with their own Merchant Code.Each Product code must be Unique.To achieve this but still allow each Merchant to freely assign his own Product Code system I need to prefix the entered Product Code with the appropriate Merchant Code.The Merchant Admin uses php forms and the product code field is:<input type="text" name="code" id="code" value="<?php echo KT_escapeAttribute($row_rsstock['code']);?>" size="12" />The insert function in the head of the page is:$ins_stock->addColumn("code", "STRING_TYPE", "POST", "code");For example I would like a product code ABC123 entered by Merchant D100 to automatically become:D100-ABC123 on insert.I also need to prevent the automatically inserted prefix being overtyped in the form field.As I am very much a beginner in PHP & MYSQL, a simple expression would be preferred with enough info for me to impliment with my limited knowledge.Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Wintergreen Posted September 29, 2006 Share Posted September 29, 2006 Why not just add the merchant code after they've input their code? Let them input ABC123 and whatever other details and submit it, and then just add the prefix right before you insert it to the DB Quote Link to comment Share on other sites More sharing options...
piskie Posted September 29, 2006 Author Share Posted September 29, 2006 The form has 14 fields. Some Text and some Hidden.It also has several image file upload, resize and rename fields and functions.All this happens on "Submit".I want to add the Merchants Code to the Product Code with the least complications possible.When the Submit Button operates, there's a lot going on and I don't feel able to intercept just the "code" value and modify it and then continue to submit.I am hoping for some function or other to be include around the Insert Function:$ins_stock->addColumn("code", "STRING_TYPE", "POST", "code"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.