1

Html form submits data to a php. Php loads it into a database and passes on the data (in this case usr ) to a html document( resultpg.html ).

I need the html document to say "Hi NameOfUser,".

The snippet from the page containing html form:

<form class="login-form" action="/form.php" method="POST">
<input type="text" name="usr" placeholder="username"/>
<input type="password" name="pwd" placeholder="password"/>
<button type=submit form="form1" value="submit">login</button>

I have redirected my form.php to open the html like:

if ($connect->query($query) === TRUE) {
header( 'Location: resultpg.html' );

} else {
echo "Error: " . $query . "<br>" . $connect->error;
}
Imacoder
  • 441
  • 4
  • 7
  • you can't output phpvariable into html page. your page must have `.php` extension – Anant Kumar Singh Aug 29 '17 at 21:22
  • *"I need the html document to say "Hi NameOfUser,"."* - If I understood that correctly, you'd need to instruct your server to treat `.html` files as PHP; is that what the question is about? – Funk Forty Niner Aug 29 '17 at 21:22
  • @AlivetoDie *"you can't output phpvariable into html page. your page must have .php extension"*- Not necessarily and I think you know it ;-) See my above comment. – Funk Forty Niner Aug 29 '17 at 21:23
  • 1
    @Fred-ii- we do find examples in mail and social websites. Then how do we achieve that ? – Imacoder Aug 29 '17 at 21:25
  • I've closed the question; that's what this is about. – Funk Forty Niner Aug 29 '17 at 21:25
  • @Imacoder those two are totally different animals than what you're working with. – Funk Forty Niner Aug 29 '17 at 21:26
  • @Fred-ii- I'm running my scripts on wampserver on windows and **AddHandler application/x-httpd-php .html .htm** didn't help. I'm getting parse errors when I paste in my php script after I added it. Any help ? – Imacoder Aug 29 '17 at 21:43
  • @Imacoder If you're getting parse errors, update your post so I/others can see if there's anything wrong and what the `.htaccess` file looks like. – Funk Forty Niner Aug 29 '17 at 21:54
  • @Imacoder and please, if you're going to update your post, don't overwrite your original and mark it under it and as an edit. – Funk Forty Niner Aug 29 '17 at 21:56

0 Answers0