jamesbond110 Posted December 13, 2007 Share Posted December 13, 2007 Hi I'm a very big newb to PHP so if you tolerate my utterly retarded questions, I thank you very much! Here is a form, very basic. What it does it just allow you to type your name and comment and then post it. $template_form = <<<HTML <table border="0" width="493" cellspacing="0" cellpadding="0"> <tr> <td width="64" height="30"><div align="left">Name:</div></td> <td height="30"> <input type='text' name='name'> </td> </tr> <tr> <td width="64" height="30"></td> <td height="30"> <textarea cols="40" rows="2" id=commentsbox name="comments"></textarea> <br /></td> </tr> <tr> <td></td> <td height="30"><input type="submit" name="submit" value="Add My Comment" /></td> </tr> </table> HTML; Now for "<input type='text' name='name'>" I would like it not be editable. Here's what I would like: If a user is logged in if ((!isset($_SESSION['validUser'])) || ($_SESSION['validUser'] != true)) Then their username $username Will be the value for the "<input type='text' name='name'>". Otherwise the value would be 'guest'. If you need clarification, please post! Here is the webpage: http://tobysplayground.100webspace.net/Phat%20Cat%20Productions/index.php Thanks in advance! Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted December 13, 2007 Share Posted December 13, 2007 <input type="text" name="name" value="<?php echo $username; ?>" disabled /> hope that helps Quote Link to comment Share on other sites More sharing options...
jamesbond110 Posted December 13, 2007 Author Share Posted December 13, 2007 Did what you told to do mate and Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/www/tobysplayground.100webspace.net/Phat Cat Productions/news/data/Default.tpl on line 44 So I think I should just show you the entire .tpl file. I'm using Cutenews manager if you've had experience with that. <?PHP ///////////////////// TEMPLATE Default ///////////////////// $template_active = <<<HTML <div style="margin-bottom:20px;"> <div class="h"><strong>{title}</strong></div> <div style="text-align:justify;margin-bottom:5px;">{short-story}</div> <div style="float: right;">[com-link]{comments-num} Comments[/com-link]</div> <div><em>Posted on {date} by {author}</em></div></div> HTML; $template_full = <<<HTML <div style="margin-bottom:20px;"> <div class="h"><strong>{title}</strong></div> <div style="text-align:justify; padding:3px; margin-top:3px; margin-bottom:5px;">{short-story}</div> <div style="float: right;">[com-link]{comments-num} Comments[/com-link]</div> <div><em>Posted on {date} by {author}</em></div></div> HTML; $template_comment = <<<HTML <div> by <strong>{author}</strong> @ {date}</div> <div style="padding-top:2px;padding-bottom:10px;">{comment}</div> HTML; $template_form = <<<HTML <table border="0" width="493" cellspacing="0" cellpadding="0"> <tr> <td width="64" height="30"><div align="left">Name:</div></td> <td height="30"> <input type="text" name="name" value="<?php echo $_SESSION['userName']; ?>" disabled /> </tr> <tr> <td width="64" height="30"></td> <td height="30"> <textarea cols="40" rows="2" id=commentsbox name="comments"></textarea> <br /></td> </tr> <tr> <td></td> <td height="30"><input type="submit" name="submit" value="Add My Comment" /></td> </tr> </table> HTML; $template_prev_next = <<<HTML <p align="center">[prev-link]<< Previous[/prev-link] {pages} [next-link]Next >>[/next-link]</p> HTML; $template_comments_prev_next = <<<HTML <p align="center">[prev-link]<< Older[/prev-link] ({pages}) [next-link]Newest >>[/next-link]</p> HTML; ?> ANOTHER side note. I used the same code in the index.php and it worked like a charm. However, once I put it in the default.tpl file I got the error. I appreciate your quick response. Thanks for the help! 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.