ShoeLace1291 Posted December 3, 2007 Share Posted December 3, 2007 I have an array that will convert when my template is built. This is what it looks like: $temps = array( 'FORM_ACT' => <?php echo $_SERVER['PHP_SELF']; ?> ); What would be the correct syntax for this? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 3, 2007 Share Posted December 3, 2007 This is what it looks like: What would be the correct syntax for this? thats like saying "the door is green, is the door green?" but i assume you mean this <?php $temps = array( 'FORM_ACT' => $_SERVER['PHP_SELF'] ); ?> Quote Link to comment Share on other sites More sharing options...
ShoeLace1291 Posted December 3, 2007 Author Share Posted December 3, 2007 Well, the file that will use this is a tpl file, so php code won't work unless there's a tag. I don't want any php in my tpl files so the code <form action='FORM_ACT' method='POST'> will be <form action='<?PHP $_SERVER['PHP_SELF']; ?>' method='POST'> Get what I mean? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 3, 2007 Share Posted December 3, 2007 What! Well, the file that will use this is a tpl file, so php code won't work unless there's a tag. I don't want any php in my tpl files so the code <form action='FORM_ACT' method='POST'> will be <form action='<?PHP $_SERVER['PHP_SELF']; ?>' method='POST'> Get what I mean? you lost me.. you don't want php code in their.. so you added php code !! Quote Link to comment Share on other sites More sharing options...
ShoeLace1291 Posted December 3, 2007 Author Share Posted December 3, 2007 Yes, technically, it will be PHP. I don't like putting raw PHP in template files. It might not make sense to you. How do I put the PHP tag in an array? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 3, 2007 Share Posted December 3, 2007 Humm okay i think you wany this!! $temps = array( 'FORM_ACT' => "<?php echo $_SERVER['PHP_SELF']; ?>" ); Quote Link to comment Share on other sites More sharing options...
ShoeLace1291 Posted December 3, 2007 Author Share Posted December 3, 2007 I tried it, I'm getting a syntax error. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 3, 2007 Share Posted December 3, 2007 Try...? $temps = array( 'FORM_ACT' => '<?php echo $_SERVER[\\'PHP_SELF\']; ?>' ); PhREEEk Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 3, 2007 Share Posted December 3, 2007 hmmm.. the BBCode is stripping out the escape before the first single quote in PHP_SELF... add it PhREEEk Quote Link to comment Share on other sites More sharing options...
ShoeLace1291 Posted December 3, 2007 Author Share Posted December 3, 2007 Thanks, guys. That worked. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.