Hi,
I've written some code in PHP, which I have tried converting to ASP.NET after looking at some examples.

I'm stuck on a form processor, where I'm trying to check if some values have been filled in or not. Basicly I had a few issets() to do this in the PHP version. But, it doesn't seem to be liking what I have written in ASP. It says Expression expected.

<%
Dim rating,surveyID,vID,recommend,valid,survey,visitor,contents,message

If ((Request.Form("ratingI"))&&(Request.Form("recommend"))&&(Request.Form("sID"))&&(Request.Form("vID"))) Then

Could anyone give some pointers on this. I want all of those conditions to be true to run through the If statement I have in place.

Thanks,

See:

!string.IsNullOrEmpty(Request.Form("..."))

Hi, I had tried that. But then I get a different error.

Compiler Error Message: BC30157: Leading '.' or '!' can only appear inside a 'With' statement.

When the code is

If !string.IsNullOrEmpty(Request.Form("ratingI")) & !string.IsNullOrEmpty(Request.Form("recommend")) & !string.IsNullOrEmpty(Request.Form("sID")) & !string.IsNullOrEmpty(Request.Form("vID"))) Then

might have finally got somewhere. And just as I thought it was sorted it complains about my variables.

<%
string rating,surveyID,recommend,survey,visitor,contents,message,sID,vID;
bool valid;

if (!string.IsNullOrEmpty(Request.Form["ratingI"]))
{
    rating=Request.Form["ratingI"];
    recommend=Request.Form["recommend"];
    surveyID=Request.Form["sID"];
    vID=Request.Form["vID"];
    valid=false;

    if (String.Equals(surveyID,"1"))
    {
        valid=true;
        survey="Survey 1";
    }

    if (String.Equals(surveyID,"2"))
    {
        valid=true;
        survey="Survey 2";
    }
    if (String.Equals(surveyID,"3"))
    {
        valid=true;
        survey="Survey 3";
    }

    if (String.Equals(vID,"1"))
    {
        valid=true;
        visitor="Visitor Type 1";
    }
    if (String.Equals(vID,"2"))
    {
        valid=true;
        visitor="Visitor Type 2";
    }

    if (valid=true)
    {

    }
}
%>

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30109: 'String' is a class type and cannot be used as an expression.

It's pointing at line 2.

Any ideas? I've been pushing all this by myself and it's just frustrating what would take 10 mins to code in PHP has taken more then 4 hours.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.