Shadowing Posted December 17, 2011 Share Posted December 17, 2011 A week ago i thought i saw something about another way to display a form in the php manual but cant find it anymore. so im wondering is there another way to echo a form with out echoing every html line. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 17, 2011 Share Posted December 17, 2011 Maybe you saw HEREDOC syntax? Quote Link to comment Share on other sites More sharing options...
Shadowing Posted December 17, 2011 Author Share Posted December 17, 2011 it was like something_FORM or FORM_something Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 17, 2011 Share Posted December 17, 2011 Certainly doesn't sound like a PHP function to me. Quote Link to comment Share on other sites More sharing options...
Shadowing Posted December 17, 2011 Author Share Posted December 17, 2011 since im not trying to echo insert data into a form was wondering if there is another way to control the html with out echoing the form to control who can see the html or not. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 17, 2011 Share Posted December 17, 2011 Can you clarify what you mean by that? Quote Link to comment Share on other sites More sharing options...
Shadowing Posted December 17, 2011 Author Share Posted December 17, 2011 I have a page where I only want some users to see a html form on. and was wondering if their is a way to do it with out echoing it in line by line <?php $who3 = "SELECT monitor FROM users WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'"; $who2 = mysql_query($who3) or die(mysql_error()); $who1 = mysql_fetch_array($who2); if ($who1['monitor'] == 'admin') { echo '<div class="containerc">'; echo '<div class="search">'; echo '<form method="post" action="">'; echo '<p>Add a Mod?</p>'; echo '<input type="text" name="name" id="name" onfocus="if(this.value=="Add a Mod?")this.value=" ";" value="Add a Mod?"/>'; echo '<p class="submit"><input type="submit" name="add" id="add" value="Add"></p> <br /><br />'; echo '</form>'; echo '</div>'; echo '</div>'; } ?> also just ran into a problem. I cant make the onfocus line work with the echo. echo '<input type="text" name="name" id="name" onfocus="if(this.value=="Add a Mod?")this.value=" ";" value="Add a Mod?"/>'; Quote Link to comment Share on other sites More sharing options...
son.of.the.morning Posted December 17, 2011 Share Posted December 17, 2011 Echo the entire table in one rather than line by line, although either way it's going to have the same outcome. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 17, 2011 Share Posted December 17, 2011 Or look at HEREDOC syntax again, as that's exactly what it's most useful for. 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.