I have a value in one field and I need to complete another field based on the first filed value eg.
the first field value is “appendix” which is a Specimen type and I want the second value to display “This is an appendix”, the second type being Description. Thanks
I tried this:
if ($data[‘Specimen’]==“Appendix”)
{
$record[‘Description’].=‘This is an appendix’;
}
yeah, works
<?php
$data['Specimen']="Appendix";
if ($data['Specimen']=="Appendix")
{
$record['Description'].='This is an appendix';
}
var_dump($record);
/*
array(1) {
["Description"]=>
string(19) "This is an appendix"
}
*/
what is the problem?
And your question is?
if ($data[‘Specimen’]==“Appendix”)
{
$record[‘Description’].=‘This is an appendix’;
}
Why do you use the concatenating assignment operator ( .= ) ?
Did $record[‘Description’]
already have a value? Better said is $record[‘Description’]
already initialized? Otherwise it should be
if ($data['Specimen'] == 'Appendix')
{
$record['Description'] = 'This is an appendix';
}
1 Like
Thanks for your help, but where exactly i insert this code because I’m using phprunner 10.1
Just open a new file, copy all in and run it.