Copy link to clipboard
Copied
Hi all. I have created a function that checks two values to see if they match. If they do then just return otherwise I want a text field to display a message saying that the totals do not match. How do I update the text field value from the function?
The function:
function compare_values($TotOrdered, $TotCount)
{
If ($TotOrdered != $TotCount)
{
return "Does not match";
}
else
{
return;
}
}
I call it like this:
$Message1 = compare_values(number_ordered, total);
I tried this:
<input name="message1" type="text" id="message1" value=""'.$Message1' />
but no joy...
I keep thinking I need a POST command here but not sure...
Help!
Thanks in advance.
Robert
Copy link to clipboard
Copied
To display the value you need to embed it in a PHP block and use echo:
<input name="message1" type="text" id="message1" value="<?php echo $Message1; ?>" />
You will also need to reload the page, because PHP is a server-side language. Your function will work only when the form is submitted.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more