Hello,
I am trying to pass values between a form to another page. The form is in asp.net and it has a drop down list. this needs to be validated to make sure the user selects an option. then the form is submitted to the seconfd page for processing.
The first page with the form is shown below:
<%@ Page Language="VB" %>
<script runat="server">
Sub ImageButton_Click(sender As Object, e As ImageClickEventArgs)
Response.Redirect("test.php");
End Sub
</script>
</head>
<form method = "get" runat="server">
<asp:DropDownList id="departurepoint" runat="server">
<asp:ListItem Selected="True">Select a Departure</asp:ListItem>
<asp:ListItem>Aberdeen</asp:ListItem>
<asp:ListItem>Belfast</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator id="RequiredFieldValidator1"
runat="server" ErrorMessage="Select something!"
ControlToValidate="departurepoint"
</asp:RequiredFieldValidator>
<asp:ImageButton id="imagebutton1" runat="server"
AlternateText="Search"
OnClick="ImageButton_Click"/>
</form>
When the page is submitted to test.php, the values should be retrieved by using the get method:
Second Page:
$depoint = $_GET["departurepoint"];
echo $depoint;
The problem is the form validator does not work. Secondly, the values are not passed to the second page and hence cannot be retrieved.
I am not sure if it is the form submission that doesn t pass the values to the next page? Can you please check what is missing in the code?
Thanks in advance