Menu Content
Welcome, Guest
Please login (use login module in right column) or Register.    Lost Password?

use input fields
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: use input fields
#2205
use input fields 1 Month, 2 Weeks ago  
How can I use a field in the php code, that I have just entered in an item. For instance: If I have a field where I enter a URL, I want to use the URL in the PHP code to change it (cut something from it).
Thank you for your help.
masterbuilder (User)
Fresh Boarder
Posts: 1
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#2206
Re:use input fields 1 Month, 2 Weeks ago  
If you use a PHP-field, you can then read the other field value like this:

Code:


//get value of other field
$database->setQuery("SELECT value "
."FROM #__pi_custom_fields_values "
."WHERE (field_id='29' AND item_id=$item_id) "
."LIMIT 1 "
);
$rows = $database->loadObjectList();
foreach($rows as $row){
$field_value = $row->value;
}



change 29 to the id of the other url text field. That will get you the url, you can then work on the value and echo the cleaned url. Use the php-field code in your template and you're set.
carsten888 (User)
Administrator
Posts: 1066
User Online Now Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1


login

VirtueMart Module

Show Cart
Your Cart is currently empty.

Email Notifications

  • of updates
  • of new extensions
sign up or tick the box in your profile.

Extension for free?

make one of these:
  • translation of Admin-User-Access language files
  • translation of Frontend-User-Access language files
  • new itemtype
  • new custom-itemtype-field-type
and get a free copy of:
  • Frontend-User-Access or
  • Admin-User-Access
please read this and contact me first