I am new to programming and have a control flow question. I am working with php and the DOMPDF library to generate PDFs.
I have a jQuery script that will dynamically generate input fields for an additional SET of inputs (up to 10 sets [20 inputs]). This leaves me with the following dilemma. I have successfully tested that the following if statement will serve the functionality I expect:
if ($additional_input1!='')
$html = str_replace('{{ADDITIONAL_INPUT1}}', $additional_input1, $html);
else
$html = str_replace('{{ADDITIONAL_INPUT1}}', null, $html);
if ($additional_input2!='')
$html = str_replace('{{ADDITIONAL_INPUT2}}', $additional_input2, $html);
else
$html = str_replace('{{ADDITIONAL_INPUT2}}', null, $html);
However, this would make my code look messy. Can you please provide with suggestions as to what the most efficient way to tackle this program flow situation is?