Author |
Topic |
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-09 : 08:04:18
|
[code]if left(request.Form("phone_nu"),3) = "234" and len(request.Form("phone_nu")) < 11 then response.Redirect("sms.asp?error="&(request.Form("phone_nu"))) end if[/code] |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-06-09 : 08:15:24
|
No idea, because you didn't explain what "this does not work" means. Does it cause an error? Does it not redirect? Does it redirect to the wrong page? Does the redirection page throw an error? Does the redirection page not function properly for the parameters passed? Or does nothing happen at all? |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-06-09 : 08:18:39
|
try this:i think you have extra ( )if Left(Request.Form("phone_nu"),3) = "234" and Len(Request.Form("phone_nu")) < 11 then Response.Redirect("sms.asp?error=" & Request.Form("phone_nu"))end if Go with the flow & have fun! Else fight the flow |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-06-09 : 08:18:49
|
try this:i think you have extra ( )if Left(Request.Form("phone_nu"),3) = "234" and Len(Request.Form("phone_nu")) < 11 then Response.Redirect("sms.asp?error=" & Request.Form("phone_nu"))end if Go with the flow & have fun! Else fight the flow |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-09 : 09:18:09
|
thanks but it just doesnt work.No error, but when i put a phone number starting with 234 and less than 11 characters, it still doesnt see the error.would keep at it, anywaythanks |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-06-09 : 09:20:59
|
step #1 is to always make sure your page is successfully receiving the values from the form.Are you SURE that Request.Form("...") is returning the values you expect?- Jeff |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-09 : 09:45:26
|
Sure Jeff.Basically its an sms portal, that receives phone numbers and passes them to my providers site doing a loop. I am trying to guard against users, who dont finish typing the phone numbers in full of which we have many such examples. The values are all saved into our db, either successful or failure. So the values are correct.I even did a response.write to check the values being passed accross.If i take of the first argument it works well. ieif Len(Request.Form("phone_nu")) < 11 then Response.Redirect("sms.asp?error=" & Request.Form("phone_nu"))end if But this value is basically for my country, so thats the reason for adding the second condition, the if 234 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-06-09 : 10:01:03
|
Are you inadvertantly counting spaces at the end of the number...even when it's not filled out to the 11???break the IF condition down...and see which bit is failing. |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-09 : 10:48:22
|
break down how ?This worksquote: if Len(Request.Form("phone_nu")) < 11 then Response.Redirect("sms.asp?error=" & Request.Form("phone_nu"))end if
but adding the full code doesnt work |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-09 : 14:38:28
|
thanks all,i got it to workCODE:[CODE]Dim strNumstrNum = Trim(Request.Form("phone_nu"))if left(strNum, 3) = "234" and len(strNum) < 11 thenResponse.Redirect("sms.asp?error=" & strNum)end if[/CODE] |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-06-10 : 03:33:46
|
quote: Originally posted by jsmith8858Didn't we go over this before?
hi Jeff,its a different context, this script just checks to see if the phone numbers that originate from Nigeria are more than 11 characters. The previous, was a question about trim function.However both run in the same page.:-) |
|
|
|