Get content after submit












-1















i had this script auto login after submit the link will change and i want to download the next page automatic what i should add after the last line
here is my code



<?php
$homepage = file_get_contents('localhost/test/login.php');
echo $homepage;
?>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js" ></script>
<script type="text/javascript">
$(function(){
$("input[name=email]").val("test@test.com");
$("input[name=password]").val("test");
$('#signin-form').submit();
});
</script>


this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php
thank you










share|improve this question

























  • You haven't closed $(function() and should do redirect in your php . Using file_get_contents doesn't make a lot of sense

    – charlietfl
    Nov 22 '18 at 22:43













  • yeah i forget to closed . after auto submit that will redirect to the index i want to get the content of the index and put it in text file that what i need. i use file get content cause the page is another directory

    – Ayoubich Escobar
    Nov 22 '18 at 22:50








  • 1





    Not following what your specific problem or errors are here. Not enough problem statement details

    – charlietfl
    Nov 22 '18 at 22:52








  • 1





    i think you understand that this script in the same page of login.php that is problem

    – Ayoubich Escobar
    Nov 22 '18 at 23:13






  • 1





    i think you understand that this script in the same page of login.php that is problem but let me more explain . this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php i'm sorry sir

    – Ayoubich Escobar
    Nov 22 '18 at 23:19


















-1















i had this script auto login after submit the link will change and i want to download the next page automatic what i should add after the last line
here is my code



<?php
$homepage = file_get_contents('localhost/test/login.php');
echo $homepage;
?>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js" ></script>
<script type="text/javascript">
$(function(){
$("input[name=email]").val("test@test.com");
$("input[name=password]").val("test");
$('#signin-form').submit();
});
</script>


this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php
thank you










share|improve this question

























  • You haven't closed $(function() and should do redirect in your php . Using file_get_contents doesn't make a lot of sense

    – charlietfl
    Nov 22 '18 at 22:43













  • yeah i forget to closed . after auto submit that will redirect to the index i want to get the content of the index and put it in text file that what i need. i use file get content cause the page is another directory

    – Ayoubich Escobar
    Nov 22 '18 at 22:50








  • 1





    Not following what your specific problem or errors are here. Not enough problem statement details

    – charlietfl
    Nov 22 '18 at 22:52








  • 1





    i think you understand that this script in the same page of login.php that is problem

    – Ayoubich Escobar
    Nov 22 '18 at 23:13






  • 1





    i think you understand that this script in the same page of login.php that is problem but let me more explain . this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php i'm sorry sir

    – Ayoubich Escobar
    Nov 22 '18 at 23:19
















-1












-1








-1








i had this script auto login after submit the link will change and i want to download the next page automatic what i should add after the last line
here is my code



<?php
$homepage = file_get_contents('localhost/test/login.php');
echo $homepage;
?>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js" ></script>
<script type="text/javascript">
$(function(){
$("input[name=email]").val("test@test.com");
$("input[name=password]").val("test");
$('#signin-form').submit();
});
</script>


this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php
thank you










share|improve this question
















i had this script auto login after submit the link will change and i want to download the next page automatic what i should add after the last line
here is my code



<?php
$homepage = file_get_contents('localhost/test/login.php');
echo $homepage;
?>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js" ></script>
<script type="text/javascript">
$(function(){
$("input[name=email]").val("test@test.com");
$("input[name=password]").val("test");
$('#signin-form').submit();
});
</script>


this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php
thank you







php jquery ajax






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 23:29







Ayoubich Escobar

















asked Nov 22 '18 at 22:05









Ayoubich EscobarAyoubich Escobar

47211




47211













  • You haven't closed $(function() and should do redirect in your php . Using file_get_contents doesn't make a lot of sense

    – charlietfl
    Nov 22 '18 at 22:43













  • yeah i forget to closed . after auto submit that will redirect to the index i want to get the content of the index and put it in text file that what i need. i use file get content cause the page is another directory

    – Ayoubich Escobar
    Nov 22 '18 at 22:50








  • 1





    Not following what your specific problem or errors are here. Not enough problem statement details

    – charlietfl
    Nov 22 '18 at 22:52








  • 1





    i think you understand that this script in the same page of login.php that is problem

    – Ayoubich Escobar
    Nov 22 '18 at 23:13






  • 1





    i think you understand that this script in the same page of login.php that is problem but let me more explain . this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php i'm sorry sir

    – Ayoubich Escobar
    Nov 22 '18 at 23:19





















  • You haven't closed $(function() and should do redirect in your php . Using file_get_contents doesn't make a lot of sense

    – charlietfl
    Nov 22 '18 at 22:43













  • yeah i forget to closed . after auto submit that will redirect to the index i want to get the content of the index and put it in text file that what i need. i use file get content cause the page is another directory

    – Ayoubich Escobar
    Nov 22 '18 at 22:50








  • 1





    Not following what your specific problem or errors are here. Not enough problem statement details

    – charlietfl
    Nov 22 '18 at 22:52








  • 1





    i think you understand that this script in the same page of login.php that is problem

    – Ayoubich Escobar
    Nov 22 '18 at 23:13






  • 1





    i think you understand that this script in the same page of login.php that is problem but let me more explain . this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php i'm sorry sir

    – Ayoubich Escobar
    Nov 22 '18 at 23:19



















You haven't closed $(function() and should do redirect in your php . Using file_get_contents doesn't make a lot of sense

– charlietfl
Nov 22 '18 at 22:43







You haven't closed $(function() and should do redirect in your php . Using file_get_contents doesn't make a lot of sense

– charlietfl
Nov 22 '18 at 22:43















yeah i forget to closed . after auto submit that will redirect to the index i want to get the content of the index and put it in text file that what i need. i use file get content cause the page is another directory

– Ayoubich Escobar
Nov 22 '18 at 22:50







yeah i forget to closed . after auto submit that will redirect to the index i want to get the content of the index and put it in text file that what i need. i use file get content cause the page is another directory

– Ayoubich Escobar
Nov 22 '18 at 22:50






1




1





Not following what your specific problem or errors are here. Not enough problem statement details

– charlietfl
Nov 22 '18 at 22:52







Not following what your specific problem or errors are here. Not enough problem statement details

– charlietfl
Nov 22 '18 at 22:52






1




1





i think you understand that this script in the same page of login.php that is problem

– Ayoubich Escobar
Nov 22 '18 at 23:13





i think you understand that this script in the same page of login.php that is problem

– Ayoubich Escobar
Nov 22 '18 at 23:13




1




1





i think you understand that this script in the same page of login.php that is problem but let me more explain . this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php i'm sorry sir

– Ayoubich Escobar
Nov 22 '18 at 23:19







i think you understand that this script in the same page of login.php that is problem but let me more explain . this script is in another file named auto.php . so when i run it's work but after the submit the link localhost/login.php will redirect to localhost/index.php so what i should add to auto.php after submit to get the content of localhost/index.php i'm sorry sir

– Ayoubich Escobar
Nov 22 '18 at 23:19














1 Answer
1






active

oldest

votes


















1














Due to the lack of details, I will explain a solution (what I've got from your question).



Imagine you have a form in the auto.php page that will send some data to index.php. You asked for an approach to retrieve data/results from index.php without redirecting or something alike. This is a way you can do it by ajax:



$('#signin-form').on('click', function(e){
//e.preventDefault();
var email= $("input[name=email]").val();
var password = $("input[name=password]").val();
$.ajax({
url: 'index.php',
type: 'POST',
data: 'the_email='+ email +'the_pass'+ password ,
success: function(respond){
$('#results').html(respond);
}
});
});


In index.php use $_POST['the_email'] for email and $_POST['the_pass'] for password. Use them, manipulate them or whatever you want, and then echo the results in index.php.



Please note: in order to show the results, you have to add new div with #results id in auto.php. Like below:



<div id="results"></div>



Now all data from index.php will be shown in auto.php without redirecting.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438461%2fget-content-after-submit%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Due to the lack of details, I will explain a solution (what I've got from your question).



    Imagine you have a form in the auto.php page that will send some data to index.php. You asked for an approach to retrieve data/results from index.php without redirecting or something alike. This is a way you can do it by ajax:



    $('#signin-form').on('click', function(e){
    //e.preventDefault();
    var email= $("input[name=email]").val();
    var password = $("input[name=password]").val();
    $.ajax({
    url: 'index.php',
    type: 'POST',
    data: 'the_email='+ email +'the_pass'+ password ,
    success: function(respond){
    $('#results').html(respond);
    }
    });
    });


    In index.php use $_POST['the_email'] for email and $_POST['the_pass'] for password. Use them, manipulate them or whatever you want, and then echo the results in index.php.



    Please note: in order to show the results, you have to add new div with #results id in auto.php. Like below:



    <div id="results"></div>



    Now all data from index.php will be shown in auto.php without redirecting.






    share|improve this answer






























      1














      Due to the lack of details, I will explain a solution (what I've got from your question).



      Imagine you have a form in the auto.php page that will send some data to index.php. You asked for an approach to retrieve data/results from index.php without redirecting or something alike. This is a way you can do it by ajax:



      $('#signin-form').on('click', function(e){
      //e.preventDefault();
      var email= $("input[name=email]").val();
      var password = $("input[name=password]").val();
      $.ajax({
      url: 'index.php',
      type: 'POST',
      data: 'the_email='+ email +'the_pass'+ password ,
      success: function(respond){
      $('#results').html(respond);
      }
      });
      });


      In index.php use $_POST['the_email'] for email and $_POST['the_pass'] for password. Use them, manipulate them or whatever you want, and then echo the results in index.php.



      Please note: in order to show the results, you have to add new div with #results id in auto.php. Like below:



      <div id="results"></div>



      Now all data from index.php will be shown in auto.php without redirecting.






      share|improve this answer




























        1












        1








        1







        Due to the lack of details, I will explain a solution (what I've got from your question).



        Imagine you have a form in the auto.php page that will send some data to index.php. You asked for an approach to retrieve data/results from index.php without redirecting or something alike. This is a way you can do it by ajax:



        $('#signin-form').on('click', function(e){
        //e.preventDefault();
        var email= $("input[name=email]").val();
        var password = $("input[name=password]").val();
        $.ajax({
        url: 'index.php',
        type: 'POST',
        data: 'the_email='+ email +'the_pass'+ password ,
        success: function(respond){
        $('#results').html(respond);
        }
        });
        });


        In index.php use $_POST['the_email'] for email and $_POST['the_pass'] for password. Use them, manipulate them or whatever you want, and then echo the results in index.php.



        Please note: in order to show the results, you have to add new div with #results id in auto.php. Like below:



        <div id="results"></div>



        Now all data from index.php will be shown in auto.php without redirecting.






        share|improve this answer















        Due to the lack of details, I will explain a solution (what I've got from your question).



        Imagine you have a form in the auto.php page that will send some data to index.php. You asked for an approach to retrieve data/results from index.php without redirecting or something alike. This is a way you can do it by ajax:



        $('#signin-form').on('click', function(e){
        //e.preventDefault();
        var email= $("input[name=email]").val();
        var password = $("input[name=password]").val();
        $.ajax({
        url: 'index.php',
        type: 'POST',
        data: 'the_email='+ email +'the_pass'+ password ,
        success: function(respond){
        $('#results').html(respond);
        }
        });
        });


        In index.php use $_POST['the_email'] for email and $_POST['the_pass'] for password. Use them, manipulate them or whatever you want, and then echo the results in index.php.



        Please note: in order to show the results, you have to add new div with #results id in auto.php. Like below:



        <div id="results"></div>



        Now all data from index.php will be shown in auto.php without redirecting.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 23 '18 at 12:18









        E_net4

        12.1k63568




        12.1k63568










        answered Nov 23 '18 at 0:12









        Colin ClineColin Cline

        1,05611022




        1,05611022






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438461%2fget-content-after-submit%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            To store a contact into the json file from server.js file using a class in NodeJS

            Marschland