VERY simple form handling

Imagine this is the html form:

<form method="post" action="script">
<input type="text" name="persons_name"><input type="submit">
</form>

Basicly in "script", I want it to write to screen the value entered for "persons_name". In PHP it would be:

<?php echo(stripslashes($_POST['persons_name'])); ?>

How would you do that in ASP?

Thanks a lot.stripslashes does what in PHP?

other wise


<%
Response.Write request.Form("persons_name")
%>


If I knew what the function you place is or does then i can add the corrected code... but thats the basic without the stripslashes ...Thanks a lot afterburn.

By default in php when you receive through forms it adds forward slashes to quotes - so that you are reasonably safe inserting into databases and such. Stripslashes basicly removes it.

User-enters: Hello's
In PHP before stripslashes: Hello\'s
After stripslashes: Hello's

So the reason I use stripslashes is to basicly return exactly what the user enters (I'm not sure if this is an issue with ASP or not).

Thanks again for the asp code - also do I need a semicolon at the end of the statement?if you want to use it in SQL then you

Replace function


<%
Response.Write Replace(request.Form("persons_name") ,"'","''")
%>


in windows the escape character for a string is a single qoute so to escape it you need to place 2 of them in a row. Jscript also.

if you really want a language that uses semi-colon then use jscript on the server side.
it works almost the same as javascript, few extra stuff. you can also mix languages a page is written in ASP but not asp.net.Thanks a lot afterburn.
 
Back
Top