<b>Parse error</b>: syntax error, unexpected variable &quot;$POST&quot;, expecting &quot;)&quot; in <b>the respective file</b> on line<b>2<b>

Joined
Feb 9, 2022
Messages
1
Reaction score
0
I am workign ona sign in app in HTML/PHP.

I am using this PHP code:

```
<?php
var_dump(_$POST);
?>
```
and html:
```
<form id="myForm" action="home.html">
<div class="sign">
<p>Username:</p>
<div class="incorrect incorrect-a" id="incorrect-a"><font size="2.3584782562126348594">Username must be a minimum length of 7 characters</font></div>
<input placeholder="Username" id="inc-a"></input>
<p>Email:</p>
<div class="incorrect incorrect-b" ><font size="2.3584782562126348594">Invalid Email</font></div>
<input placeholder="Email" id="incb"></input>
<p>Password:</p>
<div class="incorrect incorrect-c"><font size="2.3584782562126348594">This password is not of good quality.</font></div>
<input placeholder="Password"></input>
<button class="submit" onclick="mfunction();" type="button"><span>Submit</span></button>
</div>
</form>
```
and js code:
```
const request= new XMLHttpRequest;

request.open("post", "signup.php")

request.onload = function() {
console.log(request.responseText)
}
request.send(new FormData(form));
```
But, in the console, it shows this:
```
<br />
<b>Parse error</b>: syntax error, unexpected variable &quot;$POST&quot;, expecting &quot;)&quot; in <b>C:\xampp\htdocs\social\signup.php</b> on line <b>2</b><br />
```

How do I fix this??
 
Joined
Nov 13, 2020
Messages
302
Reaction score
38
Your submit button calls a function 'mfunction' but you do have a function with that name in your javascript. You really do not need JS to send a form., but change the action name to the PHP program and not to a HTML program.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top