Welcome to WebmasterWorld Guest from 54.226.62.251

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

moving box over

     

jp12

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

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

WebmasterWorld Senior Member Top Contributors Of The Month



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

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



yes I did double quote it, thank you!

JD_Toims

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

WebmasterWorld Senior Member Top Contributors Of The Month



Cool, glad you got it sorted out!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month