homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
moving box over
jp12




msg:4622272
 10:08 pm on Nov 9, 2013 (gmt 0)

I have the following code, it's a mix of php and html. I'm trying to move the input boxes over to align them and when I try inline CSS, I receive parse errors. I tried adding a span style in between each <label> tag to move the text box over but it doesn't work. How do I do CSS within PHP?


<div id="content_clientlogin">

<?php

echo resultBlock($errors,$successes);

echo "
<div id='regbox'>
<form name='newUser' action='".$_SERVER['PHP_SELF']."' method='post'>

<p>
<label>User Name:</label>
<input type='text' name='username' placeholder='minimum 5 characters' />
</p>
<p>
<label>Display Name:</label>
<input type='text' name='displayname' />
</p>
<p>
<label>Password:</label>
<input type='password' name='password' placeholder='minimum 8 characters' />
</p>
<p>
<label>Confirm:</label>
<input type='password' name='passwordc' />
</p>
<p>
<label>Email:</label>
<input type='text' name='email' />
</p>
<p>
<label>Security Code:</label>
<img src='models/captcha.php'>
</p>
<label>Enter Security Code:</label>
<input name='captcha' type='text'>
</p>
<label>&nbsp;<br>
<input type='submit' value='Register'/>
</p>

</form>
</div>";
?>
</div>
</div>
<?php include('../footer.html')?>
</body>
</html>

 

JD_Toims




msg:4622642
 11:20 pm on Nov 11, 2013 (gmt 0)

You should be fine with adding inline styles, but it's better/easier to get right if reverse your single/double quotes in the PHP/HTML, because it's not only faster since PHP does not parse single quoted strings for variables, it also can have less unexpected behavior when you put something like $1 in the middle of a double "" string.

A simple example of the preceding is:

<?php

$my_var='testing';

echo '$my_var single quoted strings';
echo '<br>';
echo "$my_var double quoted strings";

?>

Will output:

$my_var single quoted strings
testing double quoted strings

My guess is you double quoted the style="" and that caused the parse error.

jp12




msg:4622892
 1:30 am on Nov 13, 2013 (gmt 0)

yes I did double quote it, thank you!

JD_Toims




msg:4623091
 11:21 pm on Nov 13, 2013 (gmt 0)

Cool, glad you got it sorted out!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved