Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

[HTML | CSS | PHP] Help Desk | Need help with Homework Or Just stuck at something?

[Image: 06zzcxr.png]


*I made the above using HTML & CSS. Not Photoshop :)

Web Developer | Game Developer
Got MyBB? Contact me for Theme Creation Or Plugin Development
I guess I'll give this a shot.

So recently I posted a thread here ( https://hackforums.net/showthread.php?ti...id43848370 ) trying to get a css element to appear when in a valid session. Ultimately, even with all the amazing help, I gave up. I'm not sure why it didn't work out, but who cares.

I need a message to appear when there is a certain cookie for my website. So, when you click the submit button for the form, it creates a cookie, all works well, and the cookie is created.

Submission Page:
PHP Code

<?php
$cookie_name 
= "submit";
$cookie_value = "1";
setcookie($cookie_name, $cookie_value, time() + (1 * 10), "/");
?>

Now, after it creates the cookie, it takes you to my home page, where I need a message saying "Success! Form submitted"
Basically, all I need is the cookie 'checker' code, once it verifies the cookie exists, I need it to run the code below it, or something like that.

This is what I need it to display ONLY when the cookie is detected
PHP Code

<?php 
<html>
<
center><h2><br><br><br><br><b><font color="#00BFFF">Sucess!</h2></font></b></center>
</
html> 

I'm clearly a noob, so the more information you provide, the easier for me to understand. Thanks!

Je t'aime
[Image: fpZ5a5g.png]

(Apr 22, 2022 04:39 PM)-Scrub Wrote:  Jokes on you, I'm not smart enough to know what he's talking about.
Okay, So I got what you are saying.

1. If you are working with cookies, you need to make sure, when that BUTTON of your is clicked, you are redirected on the same domain.

Like, if your form is at https://hackforums.net & once button is clicked, you want to redirect to http://somewebsitetoredirect.com then cookies won't work, as you have changed the website.

2. Now if you are sure that you want to redirect on the same website, then you can do one of the two things below:

a.>

So, Step 1: User submits form, and you set a cookie.
Step 2: Now on your homepage, you need to check the cookie, which can be done by:

Code
if( isset( $_COOKIE["submit"] ) )
{
      $style = "";      
}
else
{
      $style = "display: none;";
}

Now in your html, where you have this code:

Code
<html>
<center><h2><br><br><br><br><b><font color="#00BFFF">Sucess!</h2></font></b></center>
</html>

Change it to:

Code
<html>
[b]<!--[/b] Where is body? I guess you have included it :P, if not, please do -->
  <center>
      <div style="margin-top: 100px; <?php echo $style; ?>"> [b]<!--[/b] Adjust it, as per your needs -->
      <b>
      <h2><font color="#00BFFF">Sucess!</font></h2>
      </b>
      </div>
   </center>
</html>

And done.

I tested, the code works fine.

*See that I removed your <br><br> tags, and replaced them with margin-top:100px;

It is better to use CSS, rather than <br><br>

Also, you are missing, body, head tags.


And the second method is to check if the form was submitted using if(isset ($_POST['submit']))

Web Developer | Game Developer
Got MyBB? Contact me for Theme Creation Or Plugin Development
(Dec 20, 2014 10:26 PM)Isildur Wrote:  Okay, So I got what you are saying.

1. If you are working with cookies, you need to make sure, when that BUTTON of your is clicked, you are redirected on the same domain.

Like, if your form is at https://hackforums.net & once button is clicked, you want to redirect to http://somewebsitetoredirect.com then cookies won't work, as you have changed the website.

2. Now if you are sure that you want to redirect on the same website, then you can do one of the two things below:

a.>

So, Step 1: User submits form, and you set a cookie.
Step 2: Now on your homepage, you need to check the cookie, which can be done by:

Code
if( isset( $_COOKIE["submit"] ) )
{
      $style = "";      
}
else
{
      $style = "display: none;";
}

Now in your html, where you have this code:

Code
<html>
<center><h2><br><br><br><br><b><font color="#00BFFF">Sucess!</h2></font></b></center>
</html>

Change it to:

Code
<html>
[b]<!--[/b] Where is body? I guess you have included it :P, if not, please do -->
  <center>
      <div style="margin-top: 100px; <?php echo $style; ?>"> [b]<!--[/b] Adjust it, as per your needs -->
      <b>
      <h2><font color="#00BFFF">Sucess!</font></h2>
      </b>
      </div>
   </center>
</html>

And done.

I tested, the code works fine.

*See that I removed your <br><br> tags, and replaced them with margin-top:100px;

It is better to use CSS, rather than <br><br>

Also, you are missing, body, head tags.


And the second method is to check if the form was submitted using if(isset ($_POST['submit']))

Since you're being that nazi, <center> tags are no longer supported ( in HTML 5 at least )
Use CSS instead.
Nice guy, helped me with a big problem I was having.... try him out even through in a little £10 tip for helping me quick and painlessly. Great guy!
You could also use ternary condition :
PHP Code

<?php
$style 
= (isset($_COOKIES['submit'])) ? '' : 'display: none;';
?>
Thank you RebitClown :)

Thread still up, ask your problems fast!

Web Developer | Game Developer
Got MyBB? Contact me for Theme Creation Or Plugin Development
Thanks , you Help me with my own page, Good Christmas ;)
Welcome Welcome & Welcome!

Thread is still up.

Web Developer | Game Developer
Got MyBB? Contact me for Theme Creation Or Plugin Development
Hi can you help i have alredy my site with PHP script i need your help to fix something on style.css :S because i dont know well :( ?
(Dec 26, 2014 08:57 AM)AB33770 Wrote:  Hi can you help i have alredy my site with PHP script i need your help to fix something on style.css :S because i dont know well :( ?

Sure. What problem are you experiencing? Add me on skype for better and faster results :)

Web Developer | Game Developer
Got MyBB? Contact me for Theme Creation Or Plugin Development
need help with my with HTML and CSS!

I created a horizontal list under the header. My plan to cutomise it and make them look more fashionable. I might even move it inside the header! However for some reason they're out of position compare to other parts on the page.

Quote:#first ul li { display: inline;
}


Quote:<div id="first">
<ul>

<li><a href=#>p1</a></li>
<li><a href=#>p2</a></li>
<li><a href=#>p3</a></li>
<li><a href=#>p4</a></li>
</ul>
</div>


do you see anything wrong with my code? I don't😖

sorry I can't post any pictures due to my low post account
(Dec 26, 2014 05:44 PM)Amazin-flash Wrote:  need help with my with HTML and CSS!

I created a horizontal list under the header. My plan to cutomise it and make them look more fashionable. I might even move it inside the header! However for some reason they're out of position compare to other parts on the page.

do you see anything wrong with my code? I don't😖

sorry I can't post any pictures due to my low post account

Yes. It is because of some missing CSS. Browsers automatically add margins and padding to certain elements, including <ul>

So, you need to add:

[code]
ul {
margin: 0;
padding: 0;
}
[/ul]

also it is better to use display: inline-block; & list-style: none outside none;

Instead of display: inline :)

Web Developer | Game Developer
Got MyBB? Contact me for Theme Creation Or Plugin Development
OP, how can I insert into multiple tables whilst keeping the ID's the same?
(Dec 28, 2014 11:30 AM)Glenndilen Wrote:  OP, how can I insert into multiple tables whilst keeping the ID's the same?

Not sure about what you mean but isn't it what you need http://php.net/manual/en/pdo.lastinsertid.php ?


Possibly Related Threads...
Thread / Author Replies Views Last Post
by HackersSep 28, 2026 01:50 PM 9 363 Sep 28, 2026 01:50 PM
Last Post: JuWacky
by oxagastSep 3, 2022 07:52 AM 0 197 Sep 3, 2022 07:52 AM
Last Post: oxagast
by AerrowsGirlfriendJun 16, 2021 04:17 AM 1 319 Jun 16, 2021 04:17 AM
Last Post: Nachfolger