Jump to content

tracedef

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by tracedef

  1. We have two select boxes in a form, one lists months and one lists years. We want use a conditional statement to test to see if each month / year option in each select box is the current month or year and then apply a selected="selected" attribute if it is. This will enable the select boxes to always default to current month / year. I'm not quite sure where to even start in terms of php. We're looking to test if option value is equal to current month, if so, apply selected="selected", otherwise do nothing.... One section of select box: <option label="Jan" value="1" selected="selected">Jan</option> Here is a yearly example: <option label="2010" value="2010" selected="selected">2010</option> One select box currently looks like this: <select name="sm"> <option label="Jan" value="1">Jan</option> <option label="Feb" value="2" [color=red]selected="selected"[/color]>Feb</option> <option label="Mar" value="3">Mar</option> <option label="Apr" value="4">Apr</option> <option label="May" value="5">May</option> <option label="Jun" value="6">Jun</option> <option label="Jul" value="7">Jul</option> <option label="Aug" value="8">Aug</option> <option label="Sep" value="9">Sep</option> <option label="Oct" value="10">Oct</option> <option label="Nov" value="11">Nov</option> <option label="Dec" value="12">Dec</option> </select> Any feedback greatly appreciated!
  2. Thank you, have a great night!
  3. Thank you Thorpe! Finally, if I wanted to insert div's, would the following be ok in terms of best practices by simply placing it within the echo call? It works, but not sure if it is proper... thank you again for all the help! <?php if (lp_tag('loansifter_id')) { echo '<div>random text and html formatting</div>'; } else if (function_exists('insert_cform')) { insert_cform(3); } ?>
  4. If I want to insert a PHP call in the "else" part of the statement the following works, but it probably isn't the best or pretiest way to accomplish this, any feedback on a more correct way to insert a php call in the else statement? <?php if ( lp_tag('loansifter_id') > 0 ) { echo 'YES'; } else { if (function_exists('insert_cform')) { insert_cform('3'); } } ?>
  5. I really appreciate everyone's help, thank you for helping me get this straightened out, you made my night!
  6. We have a wordpress plugin that enables users to plugin in values in the wordpress dashboard that are then populated in our theme template using the following tag <?php if( function_exists('lp_tag') ) { echo lp_tag('phone'); } else {}?> . In this example it will echo the phone number, other tags are 'address', 'hours', etc. This enables us to hard code the plugin call into the template but enable users to control the values without having to touch any code via the dashboard. One of the tags is 'id_number". Our goal is to check to see if "id_number" has a value that is is greater then 0. Our goal is to put together the PHP conditional statement that does the following: if 'id_number >' 0 then do "various code" else do "various code". Something along the lines of the following, but obviously with some corrections as we're definitely a bit off with what we have come up with: ?php if ( lp_tags('id_number') > 0 ); ?> <link rel="stylesheet" type="text/css" media="screen" href="style1.css" /> <?php else ?> <link rel="stylesheet" type="text/css" href="style2.css" /> <?php endif; ?> Any feedback on the correct way to write this statement is greatly appreciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.