I'm currently busy with a database project. The idea is that you can select an option and when some options are selected the HTML form changes. I've got that all going, the only problem I have got now is that the PHP file, to which the form redirects, doesn't recognize the textbox which is placed there by a JavaScript function.
JavaScript and HTML:
<head>
<script>
function myFunction(submittedValue) {
if(submittedValue == "URL"){
var x = "URL:";
var y = "<input type='text' name='URL'>";
} else {
var x = "Bestand:";
var y = "<input type='file' name='fileToUpload' id='fileToUpload'>";
}
document.getElementById("x").innerHTML = x;
document.getElementById("y").innerHTML = y;
}
</script>
</head>
<html>
<body onload="myFunction('URL')">
<table>
<form action='Brontoevoegen_verwerking1.php' method='POST' enctype='multipart/form-data'>
<tr><td><p id='x'></p></td><td><p id='y'>N/p></td></tr>
</table>
PHP:
<?php
$URL = $_POST["URL"];
echo "$URL";
?>
Whenever I execute the PHP file I get the following error:
Notice: Undefined index: URL in /home/******/http/Brontoevoegen_verwerking1.php on line 15