Hello dear forum members,
Sending a form with filename and text in it, from a HTML page with javascript and
server side using PHP creating doesn’t always work.
Usually only the first send, but sometimes other sends are missing in between.
The situation is a large html file with many lines.
Sending with Chrome or Samsung Android or an old slow mobile with Firefox Android version 68 is no problem.
What is the problem here; javascript code compatibility ?
I have no special software and also not enough expirience to detect something with it.
I have tried in different situations; checked the quotes and used with that single or double quotes;
I use .text ipv. .textContent but also that make no difference
I checked all variables; I used var, but now let and const
I have w3c validated, but not all, because I must learn a lot off that
I checked all , and ; and replace them were I think that realy mathers
Its always the same problem the site works with Chrome and Samsung browser and
sometimes there is now request with Firefox v102
In Firefox 68 for Android v4.x on an old HTC mobile there is no problem.
Who can help ?; What is playing here aroud the code
I build this site for non commercial use and it’s temporary useable here:
myrequest.nl/_firefox.htm
I’m not really a programmer, but because of my quality thinking through my profession I have a good sense of how things should go together and also to be able to test that from different angles. Sorry but I don’t always know direct the naming conventions for some code, because I am always learning about it.
That’s also a reason why I keep it simple as it can and used no third part software
Here are snips off the code:
<form id="form3utxt" action="ab.php" method="post" target="_blank">
<input type="hidden" name="w" id="w">
<input type="hidden" name="fSA" id="fSA">
<input type="hidden" name="formSubmit" value="Submit">
</form>
Here is a lot of code with jscript variables
fSA="K"+pm+dt+"_"+na+"_("+c.substring(0,3)+r+"_"+ncc+")_"+v+"-"+vt+dd+"_("+sB+").m3u";
w="D:\KAR\"+c+t+" "+l;
Normaly there is much information in the varibles
But if i replace only text in the strings like
fSA="This_is_a_test.m3u";
w="This is a text";
the problem is staying there
document.getElementById('w').value=w;
document.getElementById('fSA').value=fSA;
document.forms["form3utxt"].submit();
And the php is here:
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$varLink=$_POST['w'];
$varBestand=$_POST['fSA'];
print "<h2>varlink inhoud:</h2>";print "<h2>".$varLink."</h2>";
print "<h2>varBestand inhoud:</h2>";print "<h2>".$varBestand."</h2>";
chdir("av");
$fs=fopen($varBestand,"a");
fwrite($fs,$varLink."n");
fclose($fs);
}
echo '<script>window.open("","_self").close();</script>';
Greeting from the Netherlands,
Herman