Jump to content

Quick help with small piece of code!


Wankness123

Recommended Posts

well here is my whole code.

 

<?php 
/*
    Copyright (C) 2009  Murad <Murawd>
					Josh L. <Josho192837>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

// Must rewrite
echo "
<fieldset>
	<legend>
		Manage User
	</legend>
	<table border='0' style="height:100%;width:570px;border:solid 1px #BBB">

	<tr class="navtitle" style="height:25px">

		<th style="width:auto">Mute A User From Posting</th>

	</tr>

	<tr>

		<td align="center" class="tdbox">

			Search for the profile name you wish to mute.

		</td>

	</tr>

	<tr>

		<td align="center">

			<form method="post" action=''>

				<input type="text" name="name" /> 

				<input type="submit" name="search" value="Search" />

			</form>

		</td>

	</tr>

	<tr style="height:25px">

		<td class="tdbox">

			<span style="float:left">

				<a href="?cype=admin">Back To Administration Control Panel</a>

			</span>

			<span style="float:right">

				<a href="?cype=admin&page=unmuteuser">Unmute User</a>

			</span>

		</td>

	</tr>

</table>

</fieldset>
";
?>

Link to comment
Share on other sites

you are echoing with double quotes, and then you use double quotes in your html. that effectively ends the echo and leaves html its trying to parse as php

see after style, it turns colors? that's because the double quote right there, it thinks you ended the echo statement.

 

you can just use single quotes but you have to end them to insert variables. that's what i do. or escape your double quotes, with \

 

so:

 

<?php
echo "abcd\"e\"fghijk";
?>

 

or even:

 

<?php
echo "
<fieldset>
	<legend>
		Manage User
	</legend>
	<table border='0' style=\"height:100%;width:570px;border:solid 1px #BBB\">";

?>

Link to comment
Share on other sites

yes you can do that, but you'll have to change a lot of double quotes, and they are standard for code like that.

 

i would do this:

 

<?php
/*
    Copyright (C) 2009  Murad <Murawd>
					Josh L. <Josho192837>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

// Must rewrite
// single quote, not double after echo
echo ' 
<fieldset>
	<legend>
		Manage User
	</legend>
	<table border='0' style="height:100%;width:570px;border:solid 1px #BBB">

	<tr class="navtitle" style="height:25px">

		<th style="width:auto">Mute A User From Posting</th>

	</tr>

	<tr>

		<td align="center" class="tdbox">

			Search for the profile name you wish to mute.

		</td>

	</tr>

	<tr>

		<td align="center">

			<form method="post" action=''>

				<input type="text" name="name" /> 

				<input type="submit" name="search" value="Search" />

			</form>

		</td>

	</tr>

	<tr style="height:25px">

		<td class="tdbox">

			<span style="float:left">

				<a href="?cype=admin">Back To Administration Control Panel</a>

			</span>

			<span style="float:right">

				<a href="?cype=admin&page=unmuteuser">Unmute User</a>

			</span>

		</td>

	</tr>

</table>

</fieldset>
'; // single quote, not double ending the statement
?>

 

just change the doubles at the beginning and en of the echo statement to singles. just note again, if you need variables in there you would end the single

 

so

 

echo 'the variable ='. $variable. ' and the echo continues...';

 

you put singles around plain text strings, and close them , with a period after to continue the echo. just review that one line you should get it.

Link to comment
Share on other sites

Don't use PHP to echo out HTML. Use PHP only for PHP specific parts (echo a variable, calculate a value, if/else, ..).

 

<?php 
/*
    Copyright (C) 2009  Murad <Murawd>
                  Josh L. <Josho192837>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

// Must rewrite
?>
   <fieldset>
      <legend>
         Manage User
      </legend>
      <table border='0' style="height:100%;width:570px;border:solid 1px #BBB">

      <tr class="navtitle" style="height:25px">

         <th style="width:auto">Mute A User From Posting</th>

      </tr>

      <tr>

         <td align="center" class="tdbox">

            Search for the profile name you wish to mute.

         </td>

      </tr>

      <tr>

         <td align="center">

            <form method="post" action=''>

               <input type="text" name="name" /> 

               <input type="submit" name="search" value="Search" />

            </form>

         </td>

      </tr>

      <tr style="height:25px">

         <td class="tdbox">

            <span style="float:left">

               <a href="?cype=admin">Back To Administration Control Panel</a>

            </span>

            <span style="float:right">

               <a href="?cype=admin&page=unmuteuser">Unmute User</a>

            </span>

         </td>

      </tr>

   </table>

   </fieldset>

Link to comment
Share on other sites

Like i said im a noob. i have no idea. but would it be like this then?

 

<table border='0' style='height:100%;width:570px;border:solid 1px #BBB'>

 

No ALWAYS use double quotes for attribute values. Worst case you could still use this:

 

echo <<<HTML
     <table border="0" style="height:100%;width:570px;border:solid 1px #BBB">
HTML;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.