Login Register






PHP noob question filter_list
Author
Message
PHP noob question #1
Sry for the question guys but you don't learn unless you dare to ask those questions .
my problem is using document.getElementById in php .
First of all i wanna ask if it could be used in php.
now i'll share what i'm trying to do :

Code:
<!DOCTYPE html> <html> <body> <form action="test2.php" method="post"> First name:<br> <input type="text" name="firstname" value="Mickey"> <br> Last name:<br> <input type="text" id="1" name="lastname" value="Mouse"> <br><br> <input type="submit" value="Submit"> </form> <?php if($_SERVER["REQUEST_METHOD"]=="POST"){ if ($_POST["firstname"] == $_POST["lastname"]) { document.getElementById("1").value="3"; echo "hi"; }} ?> <p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p> </body> </html>

what i'm trying to do is if after submit of the form the first name and last name are the same change the lastname value to 3.
i'm having the following error :

Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\test\test2.php on line 20

line 20 is the line where i used document.getElementById


Everyone should learn how to code, it teaches you how to think.

You don't have to be a Genius to know how to code you just need to be determined.

The computer is incredibly fast, accurate, and stupid; man is unbelievably slow, inaccurate, and brilliant; together they are powerful beyond imagination.

Reply





Messages In This Thread
PHP noob question - by Vi-Sion - 03-31-2017, 01:18 PM
RE: PHP noob question - by Skryptec - 04-05-2017, 07:05 AM
RE: PHP noob question - by Vi-Sion - 04-05-2017, 12:19 PM
RE: PHP noob question - by Pikami - 04-05-2017, 12:56 PM
RE: PHP noob question - by Vi-Sion - 04-05-2017, 01:14 PM