Click here to Skip to main content
15,936,850 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
    <form method="GET"><br />
<p>CPR-NR</p><br />
<input class="text1" type="cpr" name="cpr"><br />
</div><br />
<div><br />
<p class="kord">Kodeord</p><br />
<input class="text2" type="password" name="password"><br />
<p class="kord">Bekræft kodeord</p><br />
<input class="text2" type="password" name="password2"><br />
</div><br />
<input class="login-knap" type="submit" value="Opret"><br />
<br />
<?php<br />
$name = $_GET['cpr'];<br />
echo "CPR: ".$name;<br />
print "</br>";<br />
$name = $_GET['password'];<br />
echo "Kodeord: ".$name;<br />
print "</br>";<br />

What I have tried:

Screenshot - e1906b2f9124513f5848d29b144870f9 - Gyazo[^]
Updated 15-Jan-23 21:38pm
Julius Nielsen 13-Jan-23 19:39pm    
I know type="cpr" is not right :) Wrong text..
Richard MacCutchan 14-Jan-23 5:25am    
Where is the HTML that contains the data you are trying to access?
Member 15627495 14-Jan-23 6:15am    
in the 'developer tools > network' of you internet browser, you can read the header of your request.
check through this tool if cpr is the good name of your sent datas.
Richard Deeming 16-Jan-23 5:34am    
Using GET for a login form is a very bad idea. The user's credentials will be stored in plain-text in their browser's cache and history; they will be stored in plain-text in the cache of any proxy between them and your server; and they will be stored in plain-text in your server's log files.

Always use POST for login forms.

1 solution

There are many security vulnerabilities in what you are trying to achieve, I will suggest that you read up on some of them. To answer your question though, as per comments above, type is wrong, should be something like "text, list" etc.

You should also invoke the form action once submit has been selected (also don't see any form closing method), change your code -

   if( $_GET["cpr"] || $_GET["password"] ) {
      echo "CPR ". $_GET['cpr']. "<br />";
      echo "Kodeord ". $_GET['password'];

      <form action = "<?php $_PHP_SELF ?>" method = "GET">
         CPR-NR: <input type = "text" name = "cpr" />
         Kodeord: <input type = "password" name = "password" />
         <input type = "submit" />
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900