I’m using Joomla to create websites, but am learning php and css as I go along.
I’ve learned more in CSS, and I am still struggling with PHP.
Within Joomla (a CMS), I have added a component called foxcontact which is a contact form. I’m using this for a “Request a Quote” form. Within the contact form are many PHP files, but I have located what I need to change. (This is not my coding.)
[....]
$external_label .
'<input ' .
'class="' . $this->TextStyleByValidation($field) . '" ' .
'type="text" ' .
'value="' . $value . '" ' .
'title="' . $field['Name'] . '" ' .
'style="' .
'width:' . $field['Width'] . $field['Unit'] . ' !important;' .
'" ' .
'name="' . $field['PostName'] . '" ' .
$js .
'/>' .
[....]
There are 4 fields called quantity. I need the title to state Quantity1, Quantity2, etc., for the 4 different quantity fields.
Is there a way to incorporate an if statement like:
[....]
if ($field['Name'] == "Quantity")
$result .= $external_label .
'<input ' .
'class="' . $this->TextStyleByValidation($field) . '" ' .
'type="text" ' .
'value="' . $value . '" ' .
**'title=""' .**
'style="' ;
else
$result .= $external_label .
'<input ' .
'class="' . $this->TextStyleByValidation($field) . '" ' .
'type="text" ' .
'value="' . $value . '" ' .
'title="' . $field['Name'] . '" ' .
'style="' ;
[.....]
but changing the title= to the relevant quantity1, quantity2 etc.
I have been looking at an array, but cannot get it to work.
You need to add a counter someplace above in the script, like
$i=1and increment it for each Quantity field. And this is how you should call it:Let me know if this wasn’t clear enough and you need the whole part written in code.Edit, the whole thing:
remove this since we don’t need it anymore, we’ll put it in as the function parameter:
notice the
$i=1added as a last parameter with a predefined value.The rest remains the same (don’t forget the curly brackets and the increment line):