I am currently working on making a simple php script to edit certain aspects of a game in JavaScript. When attempting to pass variables from the script to the game using forms, the variable data does not seem to transfer. As of now, the script is meant to edit the RDG value of one player in the game. The code is as follows:
script.php:
<html>
<head>
<title>Form</title>
</head>
<body>
<form method="get" action="tron2.html">
<p>What are your player 1's RGB values:
<input type="text" name="color1r" /> Red
<input type="text" name="color1g" /> Green
<input type="text" name="color1b" /> Blue </p>
<input type="submit" value="Submit" />
</form>
</body>
</html>
And the portion of the code in javascript where variables are assigned
<?php
$color1r = $_POST["color1r"];
$color1g = $_POST["color1g"];
$color1b = $_POST["color1b"];
?>
<HTML>
<HEAD>
<TITLE>
Tron2
</TITLE>
<script>
var x = "<?= $color1r; ?>";
var y = "<?= $color1g; ?>";
var z = "<?= $color1b; ?>";
//more code for the game
When the game runs, the color of the player stays black, so the values of x,y,z must all be 0. Is there any reason why the values aren't being passed?