PDA

View Full Version : combining 3 form elements' value into 1


moonsyi
11-01-2010, 03:46 AM
hi, PHP newbie here!

i have created a form to generate a new part code, basically from 2 dropdown list representing part number, material code and a textfield that have a running number.

can anyone assist me on how to concatenate those 3 and later on put into a read-only text field containing the newly created part code?

the idea is like

echo (in the newpartcode Txtfield) = part number value (from dropdown list).material code value.running number txtfield value

edbr
11-01-2010, 03:52 AM
if you are sending as a $_post array then

$_POST['part number']. $_POST['material code'].$_POST['running number']:

$conbo=$_POST['part number']. $_POST['material code'].$_POST['running number']:

moonsyi
11-01-2010, 07:37 AM
if you are sending as a $_post array then

$_POST['part number']. $_POST['material code'].$_POST['running number']:

$conbo=$_POST['part number']. $_POST['material code'].$_POST['running number']:

ed, so the $conbo just straight away echo into a let say textfield in the same form, can we do that?

edbr
11-01-2010, 07:53 AM
until submitted there will be no $_POST so yes then

moonsyi
11-04-2010, 02:50 AM
ed,

i tried to pass the value first into a dialog box, but nothing shows up. am i doing it right?

<form id="form1" name="form1" method="post" action="formsubmit.php" onsubmit="return confirm('The generated code is <? echo $_POST['part_no'].$_POST['material_code'].$_POST['running_no'] ?>. Click OK to proceed.');">

edbr
11-04-2010, 05:07 AM
onsubmit is using javascript if you want this you will need to identify the field id.not an area i could help on