php_ninja Posted January 25, 2008 Share Posted January 25, 2008 ok, i don't know what i am doing wrong here, have a look. i get a "call to undefined function: display_form_text()" <?php // class and function definitions for the id maker class formInfo { var $form_text = "form_email"; function __construct($email_in) { $this->form_text = $email_in; } function display_form_text() { print("ID for email address: "); print($this->form_text); } } $form_email = new formInfo($_POST['email']); $form_email = display_form_text(); ?> Link to comment https://forums.phpfreaks.com/topic/87838-solved-call-to-undefined-function-gotta-be-an-easy-fix/ Share on other sites More sharing options...
KrisNz Posted January 25, 2008 Share Posted January 25, 2008 class methods are accessed with -> i.e $form_email->display_form_text(); Link to comment https://forums.phpfreaks.com/topic/87838-solved-call-to-undefined-function-gotta-be-an-easy-fix/#findComment-449342 Share on other sites More sharing options...
php_ninja Posted January 26, 2008 Author Share Posted January 26, 2008 thanks, i knew it was something easy. Link to comment https://forums.phpfreaks.com/topic/87838-solved-call-to-undefined-function-gotta-be-an-easy-fix/#findComment-449387 Share on other sites More sharing options...
Daniel0 Posted January 26, 2008 Share Posted January 26, 2008 formInfo::display_form_text() does not return a value so assigning it's return value to a variable is of no use. Link to comment https://forums.phpfreaks.com/topic/87838-solved-call-to-undefined-function-gotta-be-an-easy-fix/#findComment-449684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.