0

I'm having an issue getting my php script to process and display the data I input into my form.

signup.html

 <h4>Create Account</h4>

        <form action="process.php" method="POST">
            <div>
                <label for="name">Name</label>
                <input type="text" id="name" name="name">
            </div>
            <label for="username">Username</label>
            <input type="username" id="username" name="username">
        </div>
        <div>
            
            <label for="password">Password</label>
            <input type="password" id="password" name="password">
        </div>
        <div>
            <label for="passwordconfirm">Repeat Password</label>
            <input type="password" id="passwordconfirm"
            name="password_confirmation">
        </div>
        <button>Sign Up!</button>
        </form>
    </body>
    <script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
    <script src="main.js"></script>
</html> 

On my PHP script I just want to return the data I type into the inputs, just to show it's working by via -

<?php

print_r($_POST);


However when doing so, nothing is returned that I've typed into the form. Instead it displays the PHP class itself.

This is the first time I've ever used PHP so this may be something simple.

BateauG
  • 1
  • 2
  • Are you running your code on a web server with PHP enabled, or are you just opening the form in your browser? Can you run `` in a test PHP page? Also, what do you mean by "it displays the PHP class itself"? You have no PHP classes in your example. – j08691 Aug 10 '22 at 19:12
  • If you are not running a PHP server, this could be a solution: You could try to go to the directory where you have those files, do `php -S 0.0.0.0:8000` and finally open your browser - `127.0.0.1:8000`. Happy coding! – ericmp Aug 10 '22 at 19:16

0 Answers0