Simple php syntax but can't find on internet

This is likely a dumb-a** question for all of you, but I’ll be danged if they refer to it ANYWHERE at php.net or other manuals. Wikipedia has nothing.

What does this mean? “->”?

Is it an operator or what?

It is used to access members/methods of an object/class.

So you may have something like this:


  class Cat extends Animal
  {
    public $Name;
    public function __construct($name)
    {
      $this->Name = $name;
    }

    public function Speak()
    {
       echo "Meow!";
    }
  }

  $cat = new Cat('Tiger');
  echo 'Name of Cat is ' . $cat->Name . '<br /> The cat says ';
  $cat->Speak();

Wow. No wonder I didn’t find anything.

So can you explain $this->Name = $name
and how it works?

Ok, more to the point, how do I set fees to zero for all categories?

	&lt;?php foreach ($fee_options as $fee_option): ?&gt;
		&lt;h4 class="feecategoriesheader"&gt;&lt;?php echo sprintf(_x('"%s" fee options', 'templates', 'WPBDM'), $fee_option['category']-&gt;name); ?&gt;&lt;/h4&gt;
		&lt;?php foreach ($fee_option['fees'] as $fee): ?&gt;
				&lt;p&gt;
					&lt;input type="radio" name="fees[&lt;?php echo $fee_option['category']-&gt;term_id; ?&gt;]" value="&lt;?php echo $fee-&gt;id; ?&gt;"
						&lt;?php echo _wpbdp_is_fee_selected($fee_option['category']-&gt;term_id, $fee-&gt;id) ? ' checked="checked" ' : ''; ?&gt;&gt;
						&lt;b&gt;&lt;?php echo esc_attr($fee-&gt;label); ?&gt; &lt;?php echo wpbdp_get_option('currency-symbol'); ?&gt;&lt;?php echo $fee-&gt;amount; ?&gt;&lt;/b&gt;&lt;br /&gt;
						&lt;?php if (wpbdp_get_option('allow-images') && ($fee-&gt;images &gt; 0)): ?&gt;
							&lt;?php if ($fee-&gt;days == 0): ?&gt;
								&lt;?php echo sprintf(_nx('Listing will run forever and includes %d image.', 'Listing will run forever and includes %d images.', $fee-&gt;images, 'templates', 'WPBDM'), $fee-&gt;images); ?&gt;
							&lt;?php else: ?&gt;
								&lt;?php echo sprintf(_nx('Listing will run for %d day', 'Listing will run for %d days', $fee-&gt;days, 'templates', 'WPBDM'), $fee-&gt;days) . ' '; ?&gt;
								&lt;?php echo sprintf(_nx('and includes %d image.', 'and includes %d images.', $fee-&gt;images, 'templates', 'WPBDM'), $fee-&gt;images); ?&gt;
							&lt;?php endif; ?&gt;
						&lt;?php else: ?&gt;
							&lt;?php if ($fee-&gt;days == 0): ?&gt;
								&lt;?php _ex('Listing will run forever.', 'templates', 'WPBDM'); ?&gt;
							&lt;?php else: ?&gt;
								&lt;?php echo sprintf(_nx('Listing will run for %d day.', 'Listing will run for %d days.', $fee-&gt;days, 'templates', 'WPBDM'), $fee-&gt;days); ?&gt;
							&lt;?php endif; ?&gt;
						&lt;?php endif; ?&gt;
				&lt;/p&gt;
		&lt;?php endforeach; ?&gt;
	&lt;?php endforeach; ?&gt;

That is assigning the parameter of $name to the property $Name which is defined in the class.

Is $fee_options coming from a database? Are you trying to just NOT show any output from the code below or better yet, what result are you getting now that you want changed?

You know you really don’t need to start each line in php with <?PHP ?>

That’s just going to make editing your code much more difficult.

To understand the “->” syntax, you should read up on objects.

Well I think the $fee_options are coming from the database. My fear is that if I simply remove this section then the fee will be null rather than zero and I haven’t a clue what that would do to the rest of the code, so I thought forcing it to zero would be safer in the greater scheme of things.

Also when I remove the code, there is another section of code above that is declares invalid as a message comes up
Please select a fee option for the “Accessories” category. and I didn’t want to go too far with this.

Thus the request to set the fee to zero.

Okay, this is a stab in the dark, but couldn’t you just update the database column named “fee_amount” or “amount” to 0?

The problem I see, is if I alter the code you provided, it won’t actually alter the submitting of the form, as the form doesn’t submit back the “fee_amount”, it submits the fee_id, which means it will just look up the amount of the fee from the database again. So you really need to update the database.

Well, the form IS given. Here’s the entire function and I was thinking of just forcing the radio button in the form:

BTW, How do I submit this for greater readability, I don’t see

 anywhere in the toolbar.


&lt;?php
function _wpbdp_is_fee_selected($category, $feeid) {
	$fees = isset($_POST['fees']) ? $_POST['fees'] : array();
	return wpbdp_getv($fees, $category) == $feeid;
}
?&gt;

&lt;?php
// TODO
					// $html .= __("You have selected more than one category. Each category you to which you elect to submit your listing incurs a separate fee.", "WPBDM");
					// if($wpbusdirman_config_options[$wpbusdirmanconfigoptionsprefix.'_settings_config_6'] == "yes")
					// {
					// 	$html .=__(" The number of images attached to your listing will be set according to option you choose that has the most images. So if for one category you chose an option with 2 images but for another category you chose an option with 4 images your listing will be allotted 4 image slots", "WPBDM");
?&gt;

&lt;div id="wpbdmentry"&gt;

	&lt;div id="lco"&gt;
		&lt;div class="title"&gt;
			&lt;?php echo !$listing_id ? _x('Submit A Listing', 'templates', 'WPBDM') : _x('Edit Your Listing', 'templates', 'WPBDM'); ?&gt;
		&lt;/div&gt;
		&lt;div class="button"&gt;
			&lt;?php echo wpbusdirman_post_menu_button_viewlistings(); ?&gt;
			&lt;?php echo wpbusdirman_post_menu_button_directory(); ?&gt;
		&lt;/div&gt;
		&lt;div style="clear: both;"&gt;&lt;/div&gt;
	&lt;/div&gt;

	&lt;div class="clear"&gt;&lt;/div&gt;

&lt;?php _ex('Step 2 - Quartz Hill does NOT charge members for this directory service...just press Continue below.', 'templates', 'WPBDM'); ?&gt;

	&lt;?php if ($validation_errors): ?&gt;
		&lt;ul id="wpbusdirmanerrors"&gt;
			&lt;?php foreach ($validation_errors as $error_msg): ?&gt;
				&lt;li class="wpbusdirmanerroralert"&gt;&lt;?php echo $error_msg; ?&gt;&lt;/li&gt;
			&lt;?php endforeach; ?&gt;
		&lt;/ul&gt;
	&lt;?php endif; ?&gt;	

	&lt;form id="wpbdp-listing-form-fees" method="POST" action=""&gt;
		&lt;input type="hidden" name="action" value="&lt;?php echo $listing_id ? 'editlisting' : 'submitlisting'; ?&gt;" /&gt;
		&lt;input type="hidden" name="_step" value="payment" /&gt;
		&lt;input type="hidden" name="listing_data" value="&lt;?php echo base64_encode(serialize($listing_data)); ?&gt;" /&gt;

		&lt;?php foreach ($fee_options as $fee_option): ?&gt;
			&lt;h4 class="feecategoriesheader"&gt;&lt;?php echo sprintf(_x('"%s" fee options', 'templates', 'WPBDM'), $fee_option['category']-&gt;name); ?&gt;&lt;/h4&gt;
			&lt;?php foreach ($fee_option['fees'] as $fee): ?&gt;
					&lt;p&gt;
						&lt;input type="radio" name="fees[&lt;?php echo $fee_option['category']-&gt;term_id; ?&gt;]" value="&lt;?php echo $fee-&gt;id; ?&gt;"
							&lt;?php echo _wpbdp_is_fee_selected($fee_option['category']-&gt;term_id, $fee-&gt;id) ? ' checked="checked" ' : ''; ?&gt;&gt;
							&lt;b&gt;&lt;?php echo esc_attr($fee-&gt;label); ?&gt; &lt;?php echo wpbdp_get_option('currency-symbol'); ?&gt;&lt;?php echo $fee-&gt;amount; ?&gt;&lt;/b&gt;&lt;br /&gt;
							&lt;?php if (wpbdp_get_option('allow-images') && ($fee-&gt;images &gt; 0)): ?&gt;
								&lt;?php if ($fee-&gt;days == 0): ?&gt;
									&lt;?php echo sprintf(_nx('Listing will run forever and includes %d image.', 'Listing will run forever and includes %d images.', $fee-&gt;images, 'templates', 'WPBDM'), $fee-&gt;images); ?&gt;
								&lt;?php else: ?&gt;
									&lt;?php echo sprintf(_nx('Listing will run for %d day', 'Listing will run for %d days', $fee-&gt;days, 'templates', 'WPBDM'), $fee-&gt;days) . ' '; ?&gt;
									&lt;?php echo sprintf(_nx('and includes %d image.', 'and includes %d images.', $fee-&gt;images, 'templates', 'WPBDM'), $fee-&gt;images); ?&gt;
								&lt;?php endif; ?&gt;
							&lt;?php else: ?&gt;
								&lt;?php if ($fee-&gt;days == 0): ?&gt;
									&lt;?php _ex('Listing will run forever.', 'templates', 'WPBDM'); ?&gt;
								&lt;?php else: ?&gt;
									&lt;?php echo sprintf(_nx('Listing will run for %d day.', 'Listing will run for %d days.', $fee-&gt;days, 'templates', 'WPBDM'), $fee-&gt;days); ?&gt;
								&lt;?php endif; ?&gt;
							&lt;?php endif; ?&gt;
					&lt;/p&gt;
			&lt;?php endforeach; ?&gt;
		&lt;?php endforeach; ?&gt;

		&lt;input type="submit" name="submit" class="insubmitbutton" value="&lt;?php _ex('Continue', 'templates', 'WPBDM'); ?&gt;" /&gt;

	&lt;/form&gt;

&lt;/div&gt;

Okay, maybe I should approach this from a different angle, as I still don’t see where it is processing the form elements listed on the page. What plugin are you using? As I might be able to download it to see how the code is implemented.

I also sent you a PM on how to format your code using vbTags.

Odd, really. I go into the database and in the table wp_wpbdp_listing_fees, the field ‘fee’ is a Blob. WTH? The value of those entries I’ve been tinkering with are [BLOB - 184 B]

http://businessdirectoryplugin.com/ the free version. I’m building a directory for a chamber.