Hi guys, I am new here in the community. I need help on how to pass a javascript variable value to a php variable.. I am using jquery to hide form1 when the page loads. My first javascript is working fine. my code is like this:
<script type="text/javascript">
$(document).ready(function(){
$('#email').hide();
});
</script>
and here is my php code below:
<?php
$url = '';
?>
<form id="form1" method="post" action="<?=$url?>">
<label>E-Mail:
<input type="text" name="email" />
<input type="submit" name="go" value="Go" />
</label>
</form>
<form id="form2" method="post">
<label>Test: <input type="submit" name="test" /></label>
</form>
then in this code below, I want to change the value of the $url variable to a specific page, example
$url = 'test1.php';
<script type="text/javascript">
$("form#form2").submit(function(){
$("form#form1").show();
$("#tests").hide();
<?php $url = 'test1.php'; ?>
return false;
});
$("form#form2").submit(function(){
$("form#form3").show();
$("#tests").hide();
<?php $url = 'test2.php'; ?>
return false;
});
</script>
the code above doesn't seem to work. I think I am messing something here..
Thanks