Jump to content

how to validate fields in a doc? help please:)


poqoz-87

Recommended Posts

i can insert the fields into the ms sql database. what i am now trying to do is to validate the fields in the document.

 

i have tried validating the fields, but then later, i cannot insert the data  into the database.

 

can someone show me an example of how to validate fields in a document?

oopss. sorry. i m using php document and the database that i am using is ms sql database. i can connect the php document to the ms sql database. the codes that i am using to connect the php doc to the database is this:

<?php

  if (!empty($_POST["submit"])) {

        $conn = mssql_connect("<my ip address>", "<my user name>", "<my pwd>");

      mssql_select_db("lalalalalala", $conn);

    $sql = "INSERT INTO Hello (fname,lname)VALUES (";

    $sql .= "'" . $_POST["fname"] . "', ";

$sql .= "'" . $_POST["lname"] . "')";

    mssql_query($sql, $conn);

    mssql_close($conn);

    echo("<p>Entry added to database!</p>");

  }

?>

 

what i am now trying to do is to validate both of these two fields(fname & lname), when the user clicks onto the submit button. can someone give me an example of code on how to validate both of these two fields?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.