-3

I am developing a website about educational results in which my visitors can check different educational institute results by entering their roll no. The problem is when my visitor clicks the submit button he/she redirects to the institute's webpage where he/she can find his/her result. I want to show results on my website. When visitor clicks the submit button my form submits to external website grabs data from their database and display back to my webpage.

I tried the following code: You can check this page to better understand my problem: http://www.results.doyouknow.com.pk/5th-class-results-online/

<form id="result_form" class="form account-form" action="http://results.pec.edu.pk/" method="POST" target="_blank">
    <h1 style="font-size: 28px;">5th Class Result 2019</h1>
    <p style="clear: both; font-weight: bold; width: 100%; line-height: 40px;">Enter Grade 5 Roll No</p>

    <div style="width: 100%;">
        <div style="width: 23%; float: left;"><input id="roll_no" class="form-control" tabindex="" maxlength="2" name="roll_no1" type="number" placeholder="00" /></div>
        <div style="width: 23%; float: left;"><input id="roll_no" class="form-control" tabindex="" maxlength="3" name="roll_no2" type="number" placeholder="000" /></div>
        <div style="width: 23%; float: left;"><input id="roll_no" class="form-control" tabindex="" maxlength="3" name="roll_no3" type="number" placeholder="000" /></div>
        <div style="width: 23%; float: left;"><button class="button-5th" name="search">Search</button></div>
        <div style="clear: both;"></div>
    </div>
</form>

I want to submit form values to results website grab data from their database and display it back to my website.

dferenc
  • 7,918
  • 12
  • 41
  • 49
Abbas Ahmad
  • 1
  • 1
  • 1

2 Answers2

0

HTML form POST will take you to the action provided. Therefore for your case,

  • You will have to do an API call to the server using http POST.
  • Process the POST data on the end server and echo as JSON format.
  • Get the values from the server via JSON and display it in your website.

You can do all this using basic Javascript.

Your source code will depend on the server-end language.

For PHP Backend, you can check here : https://stackoverflow.com/a/24468752/10511088

Yaseen Hussain
  • 62
  • 1
  • 10
-1

You can use file_get_contents or curl to get content of required website. You can show result on your web page as it is or you can use simple html dom parser to fetch the required data.

You can also use RSS and APIs if provided by website to access your required data.

Naveed
  • 41,517
  • 32
  • 98
  • 131