0

Hi,
Need some help here again.

If you guys take a look at:
http://83.233.5.191/crurre/index.php

There is a field called "Personnummer". Fill this with:
440611-1890
Then press "Hämta personuppgifter"

It will then fetch/recieve some personal data and fill the correct fields.


But.. as you can see.
The number disappear when the site reloads, but the info fills in which is good at least. So how do I solve this? The number have to stay in the "Personnummer" field without reloading the whole page and still fill in the info.

<h1>Registrering</h1>
	<form action="index.php" method="post">
   	  <div class="input text">
		<label for="DataNum">Personnummer</label>
		<input type="text" name="personnr" id="data" value=""/>
	    </div>
	  <input type="submit" id="GetData" value="Hämta personuppgifter" />

Thats how the Personnummer (civic number) field and Hämta personuppgifter (get personal data) looks like.


Hmm hope you guys know how to fix this.. Please write it all simply. Im probably the no1 newbie in here.

Thanks in advance!!

Regards,
K

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Akash Saikia
0

What you are doing right now is not using Ajax. You just submit the form to index.php and let it reload the page (index.php) again. If you are not going to use Ajax to deal with the display, you could send the parameter back to view in PHP, and then use it to display again in your input field after you submit the form. However, Ajax would be a better way to go for.

0

Oh.. thanks for your answer.

But... The question is.. How? Hehe, Im the biggest noob in here.. Sorry! I just dont know how to code and dont have the money to pay to get it all fixed..


Thanks in advance. Appreciating the help!!

0

I would ask this question about how to retrieve parameter from the server side on the HTML page on PHP forum. I can't really remember the syntax because I have not coded in PHP for over 4 years...

0

Hi,
Need some help here again.

If you guys take a look at:
http://83.233.5.191/crurre/index.php

There is a field called "Personnummer". Fill this with:
440611-1890
Then press "Hämta personuppgifter"

It will then fetch/recieve some personal data and fill the correct fields.


But.. as you can see.
The number disappear when the site reloads, but the info fills in which is good at least. So how do I solve this? The number have to stay in the "Personnummer" field without reloading the whole page and still fill in the info.

<h1>Registrering</h1>
	<form action="index.php" method="post">
   	  <div class="input text">
		<label for="DataNum">Personnummer</label>
		<input type="text" name="personnr" id="data" value=""/>
	    </div>
	  <input type="submit" id="GetData" value="Hämta personuppgifter" />

Thats how the Personnummer (civic number) field and Hämta personuppgifter (get personal data) looks like.


Hmm hope you guys know how to fix this.. Please write it all simply. Im probably the no1 newbie in here.

Thanks in advance!!

Regards,
K

You need to add a bit of php code in the text box's value field like this...

<h1>Registrering</h1>
	<form action="index.php" method="post">
   	  <div class="input text">
		<label for="DataNum">Personnummer</label>
		<input type="text" name="personnr" id="data" value="<? php if(isset($_POST['data']){ echo $_POST['data'];} else { echo '';}) ?>"/>
	    </div>
	  <input type="submit" id="GetData" value="Hämta personuppgifter" />

It will work fine if the code that you have shown is in the index.php
What it does
1. When you submit the code by post method,server gets each and every field value of the page.
2. So if the Post method has value for field name "data",then it will print it into the textbox other wise it will put a empty string in the text box.

3. If condition is just to suppress any warnings or error,because for the first time,there will not be any value inside the $_POST,so I have made a check that it is already set [ isset] or not.


Marks it as solved if it helps :)

Edited by Akash Saikia: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.