Reply to Re: Help with PHP & Form Popup

Your name:

Reply:


Posted by Dr. No on 02/28/07 04:48

amerar@iwc.net wrote:
> Hi Everyone,
>
> I am very new to this, so I'm hoping someone can help.
>
> I have a form with buttons that a user can click. What I need to do
> is that when a user clicks a button, before the form submits, I need
> to show a popup window with a drop down list of values which were
> returned from a MySQL query. And, the value selected will help drive
> the next page shown to the user.
>
> I've created the simple PHP to query the MySQL database, and, it
> properly returns the values which I store in an array. However, I
> have no clue on how to do a Javascript popup, let alone passing the
> results from the MySQL query to be drawn on that popup html
> page........
>
> Can anyone help by either showing me some code or point me to a page
> that has what I'm looking for? I've been at this for a few hours
> already.
>
> Thanks in advance!
>

Popup windows can be launched with the window.open() method. This is well
documented on the web, and in most every JavaScript book. If you don't have a
JavaScript book, you should buy one. The language is difficult to develop even
for an experience programmer, but beginners in particular need a reference.

What you are attempting to do sounds like a bad design pattern, and there is
probably a better way to do it. There are two problems with your idea.

1. It depends on a client-side code, the execution of which may not be successful.

2. You may run into problems with popup blockers.

As for passing your data to JavaScript in a dynamically generated page, the
solution is actually trivial. You can generate JavaScript dynamically in PHP the
same way you can with HTML. Try running this on your server:

<html>
<body>
<script language="JavaScript" type="text/javascript">
<!--
// This will assign a date to a variable that
// was created by PHP.
var dateStr = "<?php print date('Y-m-d H:i:s'); ?>";

// This outputs the date variable in an alert box.
// Output should resemble: 2007-02-27 20:45:31
alert(dateStr);
// -->
</script>
</body>
</html>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация