r/PHPhelp • u/Tricky_Box_7642 • Dec 11 '25
Solved Help with updating variable
so right now, i have a slider, and a number that shows the value, but only if the the submit button is pressed first.
on the first document:
<label for="Q1">How satisfied are you that your parcel was delivered in an appropriate timeframe?
</label><br>
<input type="range" id="Q1" class="selection slider" min="1" max="10" name="Q1" value="5">
<span class="sliderValue"><?php echo "$sliderVal1"?></span>
<br>
on the second document:
$sliderVal1 = $_POST["Q1"]??'';
can someone help me with what to replace the _post with?
2
Upvotes
View all comments
Show parent comment
7
u/abrahamguo Dec 11 '25
Ah. This is a very important thing to note: PHP is a server-side language, so it ony runs when the web browser makes a request to the server (such as submitting a form). It cannot run directly in the web browser, when you interact with the web page (such as sliding the slider).
The only client-side programming language available for web sites is JavaScript, so you would need to write that logic in JavaScript.