The browser can read HTML differently than PHP does, for example paths to required files like CSS, JS, etc... Providing the pastebin would be great.
Hi guys I was working on a landing page and it required me to copy and paste all of my HTML code into a .php file. The code works and runs fine in HTML but as soon as it's copy-pasted into the PHP file none of the buttons or really anything work even when tested in the browser. Any help would be appreciated, I can provide the link to a pastebin of the .php file if needed.
The browser can read HTML differently than PHP does, for example paths to required files like CSS, JS, etc... Providing the pastebin would be great.
I figured out the problem with it, it wasn't necessarily the PHP it was a user error.
Note to beginners, never forget to redirect the style sheets when moving into new directories.
Do you have the HTML within the <?php ~php code~ ?> ?
U can ask for free email help from local webstudio in your area, they usually are welcome to help, so u can try it if the problem is still actual.
Here's how you handle form data when you're not putting HTML in a PHP file:
Here's how you handle form data when you're putting HTML in a PHP file:Code:<form action="confirm.php" method="post"> <input type="submit" id="formButton" value="Submit" /> </form>
Since the PHP will be loading with the HTML data, we don't want to automatically manage form data before the visitor can put anything in the form.Code:<?php if(filter_has_var(INPUT_POST, 'formSubmission')) { //TODO: Something with the form data... } ?> <form method="post"> <input type="submit" id="formButton" name="formSubmission" value="Submit" /> </form>
Plus don't forget to filter your inputs; it's just bad practice to call superglobal variables directly.
Code:/** @Info: Simple non-regex email address filter. */ if(filter_input(INPUT_POST, 'emailAddress', FILTER_VALIDATE_EMAIL)) { //TODO: Success } else { //TODO: Failure }