0

I wanted to style the output of the code.

CSS:

.wrapper{
    width: 60%;
    right: 0px;
    min-height: 560px;  
    margin: 0px auto;   
    width: 500px;
    position: relative; 
}

HTML/PHP:

    <div class="wrapper">
    <?php if ($re) echo "welcome to

     thescrow $username,Your Registration was successfull"; ?>
    <?php } ?>
</div>

But the output is still plain. I don't see anything wrong. Kindly correct the code. I am new to all this and can't figure it out.

Edit: (full php)

<?php
//our included config file
include "config.php";

//check whether data with the name usename has been submitted
if (isset($_POST['username'])) {
    //variables to hold our submitted data with post
    $email = $_POST['email'];
    $username = $_POST['username'];
    $password = md5($_POST['password']);
        $hash=md5( rand(0,1000) ); 
    //our sql statement that we will execute
    $sql = "INSERT INTO `user` (`id`, `username`, `email`, `password`,`hash`) VALUES (NULL, '$username', '$email', '$password','$hash')";

    //Executing the sql query with the connection
    $re = mysqli_query($con, $sql);

    //Check to see whether request was true or false
    ?>

    <div class="to_register">
    <?php if ($re) echo "welcome to

     thescrow $username,Your Registration was successfull"; ?>
    <?php } ?>
</div>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
  • Gee, could all this be caused by a missing period? `.wrapper` - and does your `$re` pan out? if it doesn't, then that could be part of the problem here, besides the missing dot. – Funk Forty Niner Oct 29 '17 at 13:27
  • comes from my full code – martin Grey Oct 29 '17 at 13:30
  • read my comment again and reload it; I edited it. it's missing a dot. – Funk Forty Niner Oct 29 '17 at 13:30
  • And it seems that you are missing the opening `{`: `if (...) {...}` –  Oct 29 '17 at 13:31
  • @aendeerei technically, you'd be correct but the OP may not be showing us everything. – Funk Forty Niner Oct 29 '17 at 13:32
  • if all this is, is a mere missing dot, then I'll be voting this down as a typo. – Funk Forty Niner Oct 29 '17 at 13:34
  • @Fred-ii- has a dot and the $re is the result of data input to the database – martin Grey Oct 29 '17 at 13:34
  • 1
    @Fred-ii- Indeed. But either is an `{` missing, or the closing `` for `wrapper` div. –  Oct 29 '17 at 13:35
  • 1
    update your post then to include the actual syntax. Someone posted an answer below but it was deleted. They'd of been wrong about this because of what you posted for "face value". You mention in comments about a database. That could be relevant but you'd need to check for errors with php's error reporting http://php.net/manual/en/function.error-reporting.php to see if your php is failing (or not). @martinGrey then post the errors, if any. – Funk Forty Niner Oct 29 '17 at 13:36
  • Just write only a text inside the div and see if it's styled. –  Oct 29 '17 at 13:37
  • @martinGrey if that's your full code, you'd be getting an `Parse error: syntax error, unexpected '}'` error here. – Funk Forty Niner Oct 29 '17 at 13:39
  • *"Indeed. But either is an { missing, or the closing"* - @aendeerei Right you are; the question was closed. – Funk Forty Niner Oct 29 '17 at 13:41
  • full code https://jsfiddle.net/ox2ezbqp – martin Grey Oct 29 '17 at 13:41
  • 1
    @martinGrey see the duplicate it was closed with. Plus, don't use that code for either academic purposes or to go live with this. It's completely unsafe. Use a prepared statement and `password_hash() / password_verify()` for passwords and not MD5. You will get hacked. – Funk Forty Niner Oct 29 '17 at 13:44
  • @Fred-ii- okay,Thanks – martin Grey Oct 29 '17 at 13:52
  • @martinGrey You're welcome. I updated your post to contain the php you used. Your query may have failed. Use error reporting as I stated earlier and add `mysqli_error($con)` to your query. Update your post below the edit I made to contain your HTML form for this, should that be failing. However, [your fiddle](https://jsfiddle.net/ox2ezbqp) contains `
    ` yet you used `.wrapper`. I've tested your code and it worked fine for me. I added a few more duplicates that you can consult. You also need to run this off a webserver. If you're using this as `file:///` it won't work.
    – Funk Forty Niner Oct 29 '17 at 14:04

0 Answers0