thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

Part 41 - Clicking on New Page not Wont Select User. #140

Open R4Z3R3X opened 9 years ago

R4Z3R3X commented 9 years ago

When i click "New Page" it doesn't say my name just says "No User". Followed the video. Cant figure out what the problem is. Any ideas? http://pastebin.com/vvyE0Uaj

creptor commented 9 years ago

First to avoid HTML errors I recommend to never have spaces inside a line of code, so in the line for the options you should put the php starting <?php right after the last HTML code.

The you should add a space before the selected option in the echo, so that the result will be ..." selected> and not ..."selected> because if it's not with the space it will not work.

creptor commented 8 years ago

did you fix this? remember to use echo ' selected'; with a space. (just like this)

v917 commented 7 years ago

@creptor I have done what you said about giving space before echo ' selected'; but I am still having the same issue.

admin/index.php: https://pastebin.com/UDB5mHut

output: AtomOutput.docx

creptor commented 7 years ago

You have to insert the selected before closing the <option> html tag... there's your mistake.

Basically this:

<option value="<?php echo $user_data['id']; ?>"><!--end of first <option> ... (mistake)-->
<?php if($user_data['id'] == $opened['user']) { echo ' selected'; }?>
<?php echo $user_data['fullname']; ?>
</option>

Should be:

<option value="<?php echo $user_data['id']; ?>"
<?php if($user_data['id'] == $opened['user']) { echo ' selected'; }?>><!--end of first <option>-->
<?php echo $user_data['fullname']; ?>
</option>
v917 commented 7 years ago

Done. Thank you so much.