On my website I have a login form which submits some data (e.g. email address) to a PHP function AND starts the function running, which creates a user.
I want to pass some additional information from the page where the form is t
This is the data I want to send through the form:
<?php
$variable = "Your Name Here"
?>
This is the form itself:
<form action='http://dev3.benefacto.org/wp-admin/admin-ajax.php' method='GET'>
<b>Work E-Mail: </b><input type='text' name='email' id='email' placeholder='Enter Your Work Email' />
<input type='text' style='display: none' name='action' id='action' value='logged_in_check2' />
<input type='text' name='variable' id='variable' value=$variable />
<input type='submit' value='Next' class='cta' />
Any for arguments sake let's say the PHP function is
function simple_name_return()
{
echo 'Hello'
$variable = $_GET["variable"];
echo $variable;
}
add_action("wp_ajax_nopriv_simple_name_return", "simple_name_return");
add_action("wp_ajax_simple_name_return", "simple_name_return");
I think this might be helpful but I am completely new to JavaScript so a bit stumped: Pass Javascript variable to PHP via ajax
Any thoughts much appreciated.