Basic HTML If statment
Ok, i know this is nto Apple related but you guys are better than any of the other foruims that i am a member of.
I need to do a basic if statment on a web page that i am developing. Bassicailly what I want to do is have a user enter a code, lets say 123, click submitt and be redirected to 123.php or what ever page.
Thanks,
-AG
I need to do a basic if statment on a web page that i am developing. Bassicailly what I want to do is have a user enter a code, lets say 123, click submitt and be redirected to 123.php or what ever page.
Thanks,
-AG
Comments
<html>
<head>
<script type="text/javascript">
function processForm()
{
if (document.entryForm.code.value != '')
{
document.location=document.entryForm.code.value + ".html";
return false;
}
else
{
alert("You messed up!");
return false;
}
}
</script>
</head>
<body>
<form name="entryForm">
<input name="code">
<a href="javascript : processForm();">Go!</a>
</form>
</body>
</html>
HTML has no if statement. It is a non-computative markup language.
Javascript has an if statement. It is a Turing-complete computational language that can be embedded as a script element in HTML.
</mode>
So what we are doing is sending out one final mailing to tell the subs that if they wat to get bid requests they need to go to our website and enter in the code for the construction company that is requisting there infromation
-AG
<%
dim sendto, invitation
invitation = request.form("textfield")
\t\t
select case invitation
case "abc"
\tsendto = "abc.html"
case "123"
\tsendto = "123.html"
case else
\tsendto = "error.html"
end select
response.redirect(sendto)
%>
Just add a new case statement for each invitation you have. Also, either create an error page that will redirect them back to the main page or, if you already have an error page, change the case else statement to reflect your current error page. This page will not even be seen. It just acts as an intermediary processing page to do a little redirection.
When you say at the top what do you mean? before the <html> tag?
The invitation = request.form("textfeld") string grabs the value they entered on the previous form. Here's the breakdown:
invitation: Just a variable created on this page to be used in the select/case statement.
request.form: The VB command telling it to look at the form from where the page was called.
("textfield"): Tells which field from the form to assign to the variable. On your page you posted you have the field name set to textfield. If you change that...you'll need to change this as well.
Hope that helps.