/    Sign up×
Community /Pin to ProfileBookmark

HTML into PHP password code

Hi – I’m having a problem with the HTML and PHP listed in the code below. As you can see, if the user gets the correct password, it should just print out some html, and then go back into the PHP code to finish off the PHP coding for the password system.

Sadly, when it’s executed in any browser, while the HTML does show, the link can’t be clicked on (although it is formatted in the way of the linked stylesheet). See [url]www.flat39.co.uk/canal/admin[/url] (username is currently set as nickismeagain, password naRRow0010) and when you click on submit, you’ll see the problem.

Anyway, is this code completely wrong in the world of PHP? Should I be looking for a different way altogether for printing long HTML bits in the middle of a load of PHP code?

[CODE]
if ($username == $correct_username)
{
if ($password == $correct_password)
{
?>
<p>Do you wish to edit… </p>
<li><a href=”newsadmin.php”>CanalInfo News</a></li>
<li>CanalInfo Books</li>
<li>CanalInfo Holiday Reviews</li>
<li>CanalInfo Letters</li>
<?php
}
else
{
print “<p>Incorrect password. Please try again</p>”;
}
[/CODE]

Thanks once again for any help! You’re all rather wonderful people! ?

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@vi5inAug 09.2005 — I am unable to click your submit button (from Firefox)
Copy linkTweet thisAlerts:
@nickismeauthorAug 09.2005 — Eek - sorry I was just trying something, and I guess you probably clicked on it when I was messing about.

Apologies! Anyway, if you're still around try it again (please!!)!
Copy linkTweet thisAlerts:
@Daniel_TAug 09.2005 — It seems you have both double and single quotes around the HREF. Remove the single quotes and it should work.

[u]edit [/u]

Nevermind, seems you just fixed it ?
Copy linkTweet thisAlerts:
@bokehAug 09.2005 — It is caused by a CSS error here:

#container

{

position:relative;

margin: 0 auto;

width:800px;

[B]padding 0px[/B] 0px 0px 0px;

}

Try putting a '[B]:[/B]'.
Copy linkTweet thisAlerts:
@nickismeauthorAug 09.2005 — Bokeh - cheers for pointing that out - that was quite stupid of me... I've edited the css, but still get the same problem... weird.

Sorry about that Daniel T, I was just messing again and pasted the wrong code. Doh...

And Felgall, cheers for the link - that's helpful, because I wasn't sure if my code was completely wrong, but I guess it isn't. Just doesn't work.

Sorry about the mess guys, I'm a tad tired... still can't work out what's gone wrong though...
Copy linkTweet thisAlerts:
@bokehAug 09.2005 — There is still something nasty in that stylesheet if I comment it out of the html the page works.
Copy linkTweet thisAlerts:
@nickismeauthorAug 09.2005 — OK cheers Bokeh, I'll have a play with the CSS
Copy linkTweet thisAlerts:
@nickismeauthorAug 09.2005 — Hmm... can't work this out, but I've stuck all that code into another div, and it works fine now.

[CODE]
if ($password == $correct_password)
{
?>
<div id="booksMain">
<p>Do you wish to edit... </p>
<li><a href="newsadmin.php">CanalInfo News</a></li>
<li>CanalInfo Books</li>
<li>CanalInfo Holiday Reviews</li>
<li>CanalInfo Letters</li>
</div>
<?php
}
else
{
print "<p>Incorrect password. Please try again</p>";
}
[/CODE]


Don't really understand why it had a problem the first time around, but this'll be good enough for me at the moment. Cheers Bokeh... I'll remember to try taking the CSS off for debugging in future!
×

Success!

Help @nickisme spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...