Jump to content

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.