![]() |
Translate this php code
Hi
I am nob in ASP, can someone please translate to me this php code into asp ? Code:
$var1 = $_POST['userAge']; |
Code:
<%Ditto the use of Server.URLEncode. But neither will hurt. Hope you noticed the close resemblance of the code to AJAX in JavaScript. Microsoft actually was doing it like this way back in about 1997, long before AJAX came along. |
Thank so mush for your clear help. Yes not really in need for Trim and Server.URLEncode but because it don't harm anyone so I leave it as is. Still a simple question is that code can be inserted in any asp or aspx file ? I want the code for both ASP 3.0 as well as ASP.NET ?
|
asp is very differnt than asp.net (.asp .aspx) asp uses vbscript and while it may be close to vb.net (aspx/asp.net) it still is different in a lot of ways... you also have more options in .net such as C# (and then there are the obscure ones like J# and F#) - vb will prob be the easiest for you since you are moving from vbscript (well provided that is what you are doing)
|
That is for ASP, only.
ASP.NET code would be completely different. If you don't know how to write ASP.NET code, then you should avoid this stuff until you understand ASP.NET a *LOT* better. Even if this code worked with ASP.NET (and it could work, with only a few changes), what would you then do with the contents? With ASP.NET that won't be a simple answer. |
I was confused and thinking that ASP/ASP.NET is a single language. That true that it need serious knowledge and not translating like that, the situation is that I am working with php "You can see that the url is pointing to a php script" that I have experience with but this is a single process that must be run from server running ASP that is all the story :)
It would be awesome if someone post to me the code translation for both VB and C#. Is it : url = "http://externalwebsite.com/script.php?temp1=" & Server.URLEncode(var1) _SPACE &SPACE "temp2=" & Server.URLEncode(var2) OR url = "http://externalwebsite.com/script.php?temp1=" & Server.URLEncode(var1)NOSPACE_&NOSPACE"temp2=" & Server.URLEncode(var2) Thank You |
Quote:
|
Quote:
|
Quote:
|
Quote:
When you put it all on one line, you REMOVE the underline characters. VBScript uses an underline at the end of a line to mean that the code is continued on the next line. Look, you clearly should *NOT* be doing this, even in ASP code. It's obvious that you don't know enough about ASP to even use the code I gave you in creating the rest of the page. If you aren't willing to take the time to learn ASP (or ASP.NET) then hire somebody to do it for you. |
Thank You for clarification about underline. I need this code that I have posted in the first post only to be converted into C# and Visual Basic. If I make programs by those languages then I will learn them so please just this code above, and I will not post further codes because this is the only code I am in need for translation.
|
Hi bro, regarding your code as well You know that the & symbol should be present in the url so I guess you forget the & to be included so the line should be "I suppose the url is in a single line okay"
url = "http://externalwebsite.com/script.php?temp1=" & Server.URLEncode(var1) & "&temp2=" & Server.URLEncode(var2) I just changed "temp2=" to "&temp2=" |
Correct.
I'm not going to attempt to translate that to VB.NET or C# until you can explain why you *possibly* would need it it *BOTH* those languages. Choose one. No reason to use both. |
Hi again and thanks for your reply.
Quote:
<script runat="server" language="C#"> ... </script> So you can tell me the code only for C# that's enough :thumbsup: |
There is no need for you to past to me the neither the C# or VB conversion of this source code. Fortunately I succeed to establish it my self after a little learning. I am glad for that so the only hard thing that remain for me and the last thing I can ask someone for help is to convert this code to Java Server Pages code. Unfortunately there is a few few documentation about JSP on the web in comparison to MS .NET.
Thank you for your help and hope to hear you. PS : I wouldn't like to create a new topic in the JSP forum to not pollute the forums with the seem topic. Regards |
| All times are GMT +1. The time now is 08:06 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.