Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 175
  • Last Modified:

Add PHP and Ajax to CSS popup

How does one add PHP to a button on a form (popup) that is CSS?
0
DS928
Asked:
DS928
  • 2
1 Solution
 
Shahzad Fateh AliWeb Solutions Architect - VentureDive (Pvt) LtdCommented:
Actually, you add a JavaScript function on the button in popup, which call the php script using Ajax Call. You cannot add php directly to any button.
0
 
DS928Author Commented:
Thank you.  Can you show me an example please?
0
 
Slick812Commented:
greetings  DS928, , ,  Using AJAX on web sites is very common, and a very useful thing to add better user experience for an "Interactive" page. But unlike making a single web page (a PHP file), using AJAX requires a three step process, first is the web page Javascript that will be activated on a user touch of a button (your button in question).  The javascript gets the variables from user choices (like radio checkbox), and then sends them to a PHP page using the javascript   XMLHttpRequest( )   object. The second step is the PHP server process, that gets the request and then does code to get information (access database, do lookups), and then outputs this information using echo to a result string. This result string is sent back to the browser javascript, the third step is the javascript process for the AJAX onreadystatechange function that receives the string from the PHP server. This function will sort out and use the information in the server string to update elements on the web page, or for your case, create and show an overlay <div> (you call a popup). It usually takes some time for someone to learn how to use AJAX.

Maybe if you give some more information about what you are trying to do, me or someone can write example code?
0
 
DS928Author Commented:
Hello.  Here is the html.
 <li><a href='#'id="popup" onclick="div_show()">Log-In</a></li>

Open in new window

Once the pop-up comes up. The email and the password are filled in.  Then the user clicks on the Log In button.
The database is updated. and another css div pops up saying that you are now logged in.  I have included the files...
log.css
tips.html
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now