pop ups

  • Kurthead+1
  • Graduate
  • Graduate
  • Kurthead+1
  • Posts: 131

Post 3+ Months Ago

I was trying to make a "thank you" popup window with JavaScript that executes when a form submits to a php file. It was such a hassle and when I finally got it work, aspects of it still didn't work the way I wanted, and I realized I could just make a fixed position, invisible div that becomes visible when the submit button is pressed. Is there any reason I shouldn't do this? Proper CSS can make it look just like a popup window.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

why wont you just do a javascript thank you box?

Code: [ Select ]
<script>
alert("Hello! Thank you!");
</script>
  1. <script>
  2. alert("Hello! Thank you!");
  3. </script>


Or if that don't work do it like this.

Code: [ Select ]
<script>
function myFunction()
{
alert("Hello! Thank You!");
}
</script>

<input type="button" onclick="myFunction()" value="Show alert box" />
  1. <script>
  2. function myFunction()
  3. {
  4. alert("Hello! Thank You!");
  5. }
  6. </script>
  7. <input type="button" onclick="myFunction()" value="Show alert box" />
  • Kurthead+1
  • Graduate
  • Graduate
  • Kurthead+1
  • Posts: 131

Post 3+ Months Ago

It has to be a little more elaborate than that. It's for a client and I have specific instructions as to what all it is supposed to contain (which the alert box lacks), but it actually worked out really well this way, because I had full control over its css and everything.
I just wanted to make sure that this wouldn't cause any problems on maybe other browsers or something. I can link it and you can check it out. The php doesn't send information to any email atm, so you can just click the button that says "submit." Since the site is for a client I'll pm you the link.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I don't think you would have any problems with that. Many websites use popups like that where they show or hide a div instead of using alerts or real javascript popups as they aren't prone to the same problems that popup blockers would have. So I think you are going the right way.
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

Well after looking at what you have. It seems like you have something that works already. No? Apparently I am missing something.

The site works in
Chrome
Safari
Opera
FireFox


The site looks fonky in IE8



Side note. I am unsure as to why maybe just testing but it popup a new window to submit the requested information. Just letting you know.
  • Kurthead+1
  • Graduate
  • Graduate
  • Kurthead+1
  • Posts: 131

Post 3+ Months Ago

Thanks guys.
Yeah my sites always looks jacked up in IE9 or lower, until the end. I always make a less than IE9 .css file at the end to fix all the other stuff. And yeah I'm trying to figure out how to get the php page to not distract from the popup. Idk how yet, since it is a form, the php page has to open, but I have a set timeout of 1 millisecond that closes the page after the script runs.
And yeah I guess I knew it looked right, I just didn't know if it was like cheap or unprofessional or weird.
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

the pop up is caused by your form target.
  • Kurthead+1
  • Graduate
  • Graduate
  • Kurthead+1
  • Posts: 131

Post 3+ Months Ago

Yeah, I knew that I just didn't know how to make it unnoticeable, but finally got it. I just made it open up in an off-screen window and close immediately, so that it's not even noticed. Except in IE10 because IE10 wants confirmation from the user, before a page is closed on its own.
  • Kurthead+1
  • Graduate
  • Graduate
  • Kurthead+1
  • Posts: 131

Post 3+ Months Ago

I don't know what people normally do to hide php submission pages.
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

well for me i do
Code: [ Select ]
<form action="submit.php" method="POST" name="test">


BUT
on the submit page i have to have it redirect to the new page or previews page using this.


Quote:
header("Location: test.php");
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 477

Post 3+ Months Ago

I use to and sometimes still do submit to the same page.

I would have the PHP at the top encapsulated by
PHP Code: [ Select ]
<?php
// Check for post
if($_SERVER['REQUEST_METHOD'] == 'POST') {
 
    // Form processing code here
 
}
 
?>
<html>
<head>
<title>Example</title>
</head>
<body>
<form action="<?php echo $_SEVER['PHP_SELF']; ?>" method="POST" name="test">
    <!-- Form stuff here -->
</form>
</body>
</html>
 
 
  1. <?php
  2. // Check for post
  3. if($_SERVER['REQUEST_METHOD'] == 'POST') {
  4.  
  5.     // Form processing code here
  6.  
  7. }
  8.  
  9. ?>
  10. <html>
  11. <head>
  12. <title>Example</title>
  13. </head>
  14. <body>
  15. <form action="<?php echo $_SEVER['PHP_SELF']; ?>" method="POST" name="test">
  16.     <!-- Form stuff here -->
  17. </form>
  18. </body>
  19. </html>
  20.  
  21.  


I typically use this on contact forms. Another thing i do are what DemonMaestro posted, and lastly This is something that I currently use about 99% of the time AJAX
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 477

Post 3+ Months Ago

Back onto the popups have you gotten into jQuery yet? They have a dialog box that would suite your needs. http://jqueryui.com/dialog/
  • Kurthead+1
  • Graduate
  • Graduate
  • Kurthead+1
  • Posts: 131

Post 3+ Months Ago

Damn, I haven't started learning jquery yet, been too busy with other necessity languages I need to do the projects like php and SQL, while furthering other things I already know (html, css, javascript), I need to get around to it though, since it provides more options, and often when I need to look something up the answer is only in jquery, so it's disadvantageous, but I'm pressed for cash right now, so mainly grinding the php. I'll definitely get back on jquery though.
  • ScottG
  • Proficient
  • Proficient
  • ScottG
  • Posts: 477

Post 3+ Months Ago

jQuery is javascript its just a framework its simple and free
  • Kurthead+1
  • Graduate
  • Graduate
  • Kurthead+1
  • Posts: 131

Post 3+ Months Ago

Yeah, JavaScript library, just with a different syntax. I need to go ahead and learn the syntax, I wasn't sure how in depth or how long it would take to learn.

Post Information

  • Total Posts in this topic: 15 posts
  • Users browsing this forum: No registered users and 57 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.