Answer the question
In order to leave comments, you need to log in
How to substitute values from a table into a form to send to the server?
There is a plate with cells
. The cell contains a number of parameters ID of the element, the Symbolic code of the property and the value of this property, plus, depending on the value, the inscription "Free" or "Busy" is displayed.
Now visually it looks like this: 156847Q112600FREE
where 15684 is ID, Q11 is property, 2600 is value
We need to make these parameters passed to the form below for API
Here is the code (but it's not a form yet)
<?
$ELEMENT_ID = 156847; // код элемента
$PROPERTY_CODE = "Q11"; // код свойства
$PROPERTY_VALUE = "2600"; // значение свойства
// Установим новое значение для данного свойства данного элемента
CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, false, array($PROPERTY_CODE => $PROPERTY_VALUE));
?>
<td>
<?
if ($person['Q11'] == 'N') {echo ($ELEMENT_ID).($PROPERTY_CODE).($PROPERTY_VALUE).'<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
Answer the question
In order to leave comments, you need to log in
156847Q112600FREE
where 156847 is ID, Q11 property, 2600 value
if it is not possible to set your own value string format,
then all that remains is to parse the value string and get the necessary data,
everything up to Q is $ELEMENT_ID
if in Q11 - the number of characters after Q is always = 2, then we count 2 characters from Q - it will be $ PROPERTY_CODE.
or if the number of characters is not equal to 2 (i.e. Q11 can change), then initially you need to get all the property codes and check the code in the line, if found, then write the
remaining line to $PROPERTY_CODE = $PROPERTY_VALUE
after receiving all the data - send the request api where the function meets youCIBlockElement::SetPropertyValuesEx($ELEMENT_ID, false, array($PROPERTY_CODE => $PROPERTY_VALUE));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question