I am having a form page called Test Form with this form :
<div id="container">
<form action="wp-content/themes/max-magazine/TestForm.php" method="post" name="myForm">
User <input type="text" name="uname" />
Email <input id="email" type="text" name="uemail" />
Password <input type="password" name="upass" />
<input type="submit" value="Submit" /></form>
</div>
And in backend am having a php file named TestForm.php
<?php
function create_account(){
$user = 'AccountID';
$pass = 'AccountPassword';
$email = '[email protected]';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'contributor' );
}
}
add_action('init','create_account');
?>
Now if this function is defined in function.php then it works fine and create the user but same function in TestForm.php does not work. Please help
Also I will be fetching data from form like this :
<?php
$user = $_POST['uname'];
$pass = $_POST['upass'];
$email = $_POST['uemail'];
?>