mboehler3 Posted July 27, 2009 Share Posted July 27, 2009 I am new to PHP and ASP, and in working with ASP, I found that you can insert <% dim %> at the beginning of the page to set a variable. For example, I am creating 50 pages of payroll content for each state. At the top of each individual page, I have this code: <% dim currentstate currentstate = "Maryland" %> And when I want to call the state name, I insert this code: <%=currentstate %> which outputs "Maryland"This is great, but now I want to do the same thing with PHP. I've been looking around the internet and everything I come across is very elaborate. Shouldn't there be a simple answer?Thank you for your help! Link to comment Share on other sites More sharing options...
justsomeguy Posted July 27, 2009 Share Posted July 27, 2009 <?php$currentstate = 'Maryland';?><?php echo $currentstate; ?> Link to comment Share on other sites More sharing options...
gekk0 Posted July 28, 2009 Share Posted July 28, 2009 <?php echo $currentstate; ?>should be able to do this for short as well<?=$currentState;?> Link to comment Share on other sites More sharing options...
justsomeguy Posted July 28, 2009 Share Posted July 28, 2009 Possibly, you can't guarantee that short tags will be enabled though. The long tags always work. Link to comment Share on other sites More sharing options...
mboehler3 Posted July 28, 2009 Author Share Posted July 28, 2009 Possibly, you can't guarantee that short tags will be enabled though. The long tags always work.Thank you for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.