Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End sending and receiving data on php

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #44814
    Rohithzr
    Participant

    i hav this form in index.php




    then i want to send the values to login.php
    process the data with mysql in login.php
    and return the value / errors or data to index .php and display it

    #135258
    bizzr3
    Member

    hey , in the login.php change action attribute of form to index.php and then in the index.php you can get the value of input boxes with $_POST , something like this :
    $username = $_POST;
    and process the $username and all variables like this.

    #135264
    Rohithzr
    Participant

    @bizzr3 there is no form in login.php just a php – my sql script for checking the username and password

    #135269
    Rohithzr
    Participant

    @Melindrea Yes it is as u said!

    #135273
    Rohithzr
    Participant

    well i created a form before and was able to chk and log in and echo my data but then php sql form all were on a same page…

    #135277
    Rohithzr
    Participant

    well i just successfully sent the data to the login.php via method post
    actually the echo was getting hidden under the form so neva noticed it

    so now i need to send
    $error or $success to index.php

    #135281
    darrylm
    Member

    I believe the best way to accomplish this is with AJAX.

    Data is entered into the form and on clicking submit, instead of being taken to login.php, data is sent to login.php behind the scenes, the data is processed and returned to index.php as you wish, all seemingly in an instant without leaving index.php

    #135282
    darrylm
    Member

    This can be done quite easily using jQuery and the jQuery form plugin, http://malsup.com/jquery/form/

    #135284
    CrocoDillon
    Participant

    I think AJAX would be a good solution too. I don’t see why you’re not just posting to index.php, check if there is $_POST data and if there is, include login.php to handle that data.

    If you really want to post to login.php without using AJAX you could use session variables to set the return value/errors and redirect to index.php using the header. Then in index.php read those session variables.

    #135288
    Rohithzr
    Participant

    > I believe the best way to accomplish this is with AJAX.

    well i havnt used ajax yet so i dont know the method of using it….

    @crocodillion i succesfully did it using $_SESSION variables but i wanted to know just one more thing that can i send those errors which initially i am echoing thru $_SESSION variable

    #135821
    darrylm
    Member

    AJAX is certainly a tool worth having if you’re pursuing web development

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Back End’ is closed to new topics and replies.