Hi guys, I have a problem on my php code and url passing.
What it should do: There are 3 forms of the php file, the "email", "item1" and "item2". The email form is hidden by default on page load, it will only be visible if any of the item1 or item2 submit buttons is clicked and the two other forms will become hidden. The user will choose which item to click, then the email form will display, then the user will enter their email address, when they click the button, they should be redirected to the page that they clicked, example if they click Item 2, they will be redirected to item2.php after they entered their email address and click the button of the email form.
Problem: I have my code here, but it seems that it's not working when I click on the Get It button from the email form, it will not do anything.
Any help would be appreciated, Thanks.
Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
</head>
<body>
<div id="email" style="display: none;">
<form method="post" action="<?=$url?>" id="email">
<label>E-Mail:
<input type="text" name="email" />
<input type="submit" value="Email" />
</label>
</form>
</div>
<div id="offers">
<div id="items">
<form id="item1">
<label><input type="submit" name="getit" value="Item 1" /></label>
</form>
</div>
<div id="gifts2">
<form id="item2">
<label><input type="submit" name="getit" value="Item 2" /></label>
</form>
</div>
</div>
<script type="text/javascript">
$('#item1').submit(function(event){
event.preventDefault();
$('#offers').css('display','none');
$('#email').css('display','block');
<?=$url='item1.php'?>
});
$('#item2').submit(function(event){
event.preventDefault();
$('#offers').css('display','none');
$('#email').css('display','block');
<?=$url='item2.php'?>
});
</script>
</body>
</html>