Reputation: 2540
I thought a html input field could be populated with an url by using ?fieldname=value behind the base url But I am stuck with this all morning now.
this is the part of my html
<tr class="pure-table-odd">
<td><label for="name">Naam</label></td>
<td><input type="text" name="name" value="" required id="name" title=""></td>
</tr>
When i make a link with the following url the field still stays empty. Any suggestion?
http://83.163.140.140//web2016/spa_wellness_arrangementen/vriendinnendag_wellness_arrangement.html?name=test
ps Actually I need to check a checkbox. But I thought to try something more 'easy' first
Upvotes: 0
Views: 164
Reputation: 3178
You can't use URL-parameters like that. You will need to either process the request server-side (via PHP or similar), or via javascript. However, processing things like this opens up a lot of other potential security holes, so you should know what you're doing.
In PHP, this would be something like:
<?php
echo '<tr class="pure-table-odd">
<td><label for="name">Naam</label></td>
<td>';
if ($_GET['parameter']) { //checks if "parameter" exists in the URL string
$var = $_GET['parameter'];
echo '<input type="text" name="name" value="'.$var.'" required id="name" title="">';
}
echo '</td></tr>';
?>
Upvotes: 1