DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: help with ajax

  1. #1
    Join Date
    Nov 2008

    help with ajax

    Hi there, i have a webpage which takes in user details to store them into a database. i have 2 files html and php. the html file takes the input and sends it to the php file. when the html sends data to php the browser changes to the php file however i would like to stop this happening. when the input is not correct and the submit button is clicked on i would like to stop the html sending data to the php and to stay as it is with the incorrect data.

    i have been told that AJAX is the solution to this problem as AJAZ can check the data in the background without changing the webpage. i am totaly new to AJAX and was hoping someone would please give me some guidance.

    <form action="http://localhost/PATIENT/filename.php" method="post" name="name" id= "name" onsubmit"error checks">
    <input name="abc" type="text"/>
    <input type="text" name="xxx"/>

    database connection....
    $abc = $_POST['abc'];
    $xxx = $_POST['xxx'];

  2. #2
    Join Date
    Oct 2005
    if u r looking for a quick and simple solution, u can stay away from ajax and simply redirect from the php page to an error "section" into ur html page, or maybe a third error page ...

    a common method also is to include all in the same page, and handle the request (differentiate between the case of requesting data or posting them) by a php code like this :
    // ....
    // web input form
    if you still want to use ajax, u have to read a bit about how it's working and how to implement it, usually in your case u need another third php page ... take a look here it's a good learning tool with many good examples:

Similar Threads

    By akaballa in forum AJAX
    Replies: 1
    Last Post: 10-30-2008, 03:39 AM
  2. Ajax and Browser Positioning
    By dbrook007 in forum AJAX
    Replies: 0
    Last Post: 04-22-2008, 07:40 AM
  3. Ajax within Ajax generated code
    By geekdesign in forum AJAX
    Replies: 2
    Last Post: 09-16-2007, 08:38 PM
  4. using an AJAX function to return a value
    By k285715 in forum AJAX
    Replies: 0
    Last Post: 06-18-2007, 11:06 AM
  5. New forum + some AJAX links
    By Lori in forum AJAX
    Replies: 0
    Last Post: 02-09-2006, 02:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center