do not repeat values in databse during insertion using php and javascript

do not repeat values in databse during insertion using php and javascript

hello all, after tried so much now posting here. i have two programs sql.php and form.jsp. i want to do insert values into mssql database from user input form. sql.php is able to insert the values into database. i have connected database using ODBC.form.jsp is able to give user input form where user can enter name.

when i submit the name it will successfully stored into the database. but if i submit the same name also it will get stored. i don't want store same name twice in the database.and it should notify the user that name already exist in the database. i can't change my database schema to unique constraint. i need to accomplish throgh program. how to give this validation ?

  db.php 
  $connect = odbc_connect('SerDB','sa', 'pwd');
     echo "server connected";
     $query=("INSERT INTO namemb(name) VALUES ('$_POST[name]')");
  $result = odbc_ exec($connect, $query);

form.jsp

 <html>
 <head>
<script type="text/javascript">
function validateForm()
  {

   var y=document.forms["myForm"]["name"].value;
 if (y==null || y=="")
 {
 alert("name can be blank");
  return false;
 }
 }
 </script>

   <body>
 <form name="myForm" action="sql.php" onsubmit="return validateForm()" 
   method="post">
        Name:<input type="text" name="name">
    <input type="submit" value="Submit">
   <input type="button"  value="Cancel">
    </form>
   </body>

   </html>
View Answers









Related Tutorials/Questions & Answers:
do not repeat values in databse during insertion using php and javascript
do not repeat values in databse during insertion using php and javascript ... sql.php and form.jsp. i want to do insert values into mssql database from user input form. sql.php is able to insert the values into database. i have connected
Accessing MS ACCESS databse using a HTML webpage [created using Javascript]
Accessing MS ACCESS databse using a HTML webpage [created using Javascript]  HI team, This is Srinivas, and I have a query and i explained here... I have to save some datas in an MS ACCESS database file [*.mdb], after
Advertisements
javascript variable value insertion in DB
javascript variable value insertion in DB  how can I insert javascript variable value into database using php
retrive article from sql databse and show using php
retrive article from sql databse and show using php  hello sir i have sql database which i store articles.i want to show these article on web page using php. my field are image,title,summary,content id. plz provide me
how to generate automatic bill based on selected values using jsp/javascript?
how to generate automatic bill based on selected values using jsp/javascript?  how to generate automatic bill based on selected values using jsp/javascript
How do i validate form using javascript and send data to database?
How do i validate form using javascript and send data to database?  I need a "JOIN US" form that can validate using javascript and be able to connect...,contactNo,address,city) values('"+fname+"','"+lname+"','"+email+"','"+phone
How to make addition of two combobox values using jsp and javascript?
addition of two combobox values using jsp and javascript  How to make addition of two combobox values using jsp and javascript?  <html> <h2>ComboBox</h2> <script language="javascript"> var arr
Javascript and PHP
Javascript and PHP  Hello, I want to know how to call javascript function inside PHP code . Could you please tell me the way to call it? Thanks   Here is a simple example of php that calls javascript function. <
Insertion Sort In Java
In this example we are going to sort integer values of an array using insertion sort... .Insertion sort is a good choice for small values and for nearly-sorted values... for large values . Positive feature of insertion sorting: 
PHP SQL Insertion
PHP SQL Insertion       PHP SQL Insertion is used to execute MySQL queries in PHP script..._TO_REPLACE_2 The PHP SQL insertion is saved with .php extension. The server side
php do while syntax
php do while syntax  How to create a do while loop in php. What is the syntax
php do while example
php do while example  Simple example of do while loop in PHP
php do while loop
php do while loop  Difference between do while loop and simple loop in PHP
How to Display values from databse into table
How to Display values from databse into table  I want to display values from database into table based on condition in query, how to display... enter either bookname or authorname and click on search button the values from
Java repeat string without using loops
Java repeat string without using loops In this section, you will learn how to repeat string without using for loops. The given example accepts the number... using while loop or any other control statements. Example:ADS_TO_REPLACE_1
php do while break
php do while break   receiving a Fatal saying cannot break/continue.. please suggest. Thank U
php do while false
php do while false   Is there any difference between FALSE and false
javascript echo php
javascript echo php  i would like to know the complete syntax with the running example of using JavaScript echo in PHP. Thanks
core java project by using databse
core java project by using databse  hello sir, i'm a b.tech final year student.... i wantto make a project on java with database... can u plzz suggest me how i can start for it.... means on which topic i can make project
dynamic multiplecheckbox values insertion - JSP-Servlet
dynamic multiplecheckbox values insertion  hi How to insert dynamically generated checkbox values to store in mysql data base using jsp?  Hi Friend, Try the following code: 1)checkbox.jsp: Name
JavaScript in PHP Loop
JavaScript in PHP Loop  i wants to know how to implement the JavaScript code into the PHP Loop function. Thanks
how to put php in javascript
how to put php in javascript  How to write a javascript code inside php block
passing values form javascript - JSP-Interview Questions
passing values form javascript  please i want to pass values from javascript function to jsp code how can i do
Retrieve data from databse using where in JSP
Retrieve data from databse using where in JSP  Hi, can somebody help me? I have a jsp page. in that i want to get data from the database where username is matched. i tried it. but can't get the output. here is the code. please
special set of tags do in PHP.
special set of tags do in PHP.  What does a special set of tags do in PHP?   Hi friends, The special tag in php is <?= ?>. This tag is used to diasplay the output directly on the browser. Thanks
ID using get the databse latest value and displayed in jsp
ID using get the databse latest value and displayed in jsp   I have... ... after i click the preview button it should show the values you have entered in the form (it means latest values) ... how to retrive that values using ID
insert data into mysql databse using swing
insert data into mysql databse using swing   Blockquote hi, here is my code, i want code for store data into mysql database when click on submit button from access data from this form, please provide code, import java.awt.
PHP JavaScript form Validation - PHP
PHP JavaScript form Validation  Just looking for a general PHP JavaScript form Validation. How can I write external JavaScript Validation? Please suggest!  Hi Friend, 1) form Enter Name Enter Address
php,javascript,html
php,javascript,html  Hi, thank u for answered the previous question. one more question: when i register the student details, unique register number should be created and incresed automatically for every student based
Hiding form values using ajax
Hiding form values using ajax  i am trying to show and hide form values with ajax but it's not working,but in javascript it is working.Can anyone will help me to the work in ajax please. Thanks in advance
What does a special set of tags <?= and ?> do in PHP?
What does a special set of tags do in PHP?   What does a special set of tags do in PHP
php variable in javascript
php variable in javascript  Access php variables in Javascipt or Jquery rather than php echo $variable
integrate javascript in php
integrate javascript in php  how to integrate javascript into html
ID using get the databse latest value and displayed in jsp
ID using get the databse latest value and displayed in jsp  function... want to get the latest value using id and displayed in that start date end date etc,... How to get latest values in my jsp page and id will be shown in url
PHP Array Count Values
PHP Array Count Values  Sometimes  we need to count the number of values, i.e. total number of appearance of an element, in an array. PHP provides... array PHP Array Count Values Example 1: <?php $array=array("
PHP Functions and Return values
PHP Functions and Return values A function is the a block of code whom you can...; } Given below the example : <html> <body> <?php...; <?php function subtraction($a,$b) { $x=$a-$b; return $x; } echo
PHP Insert Value
'); Now to insert values into table:   ii)    Using WAMP...Insertion of data into table: We will study in this tutorial how to insert data into a table using MySQL console and phpMyAdmin. After creating table we need
delete an entry using JavaScript
delete an entry using JavaScript  How to delete an entry using JavaScript
Date object using JavaScript
Date object using JavaScript  What's the Date object using JavaScript
using for loop in javascript
using for loop in javascript  How to use for loop in JavaScript
PHP Variables in JavaScript
PHP Variables in JavaScript JavaScript and PHP both are scripting language... on the internet.ADS_TO_REPLACE_1 Let's see how can you use PHP variables in JavaScript. For example of PHP Variable in JavaScript: <title>PHP Variable
maximize an image using javaScript
maximize an image using javaScript  Write the code to maximize an image using javaScript
xls to js using javascript
xls to js using javascript  ![how can we convert a xls file in js file using javascript][1
timer using javascript
timer using javascript  How to display timer on HTML page using JavaScript
Insertion into database
Insertion into database  Hi, I need code for inserting the multiple select box values into database.Please do send me the code. Thanks for ur immediate replies its helping a lot
send mail using JavaScript
send mail using JavaScript  How can we send mail using JavaScript?   Hi friends, You can not send email directly using JavaScript. But you can use JavaScript to execute a client side email program send the email using
upload video using php
upload video using php  How to upload a video on MYSQL Server using PHP Code..? Can any one provide me an example
How do i retain values in the drop down - Struts
How do i retain values in the drop down  Hi, I have a jsp page... with the drop down. My problem is whenever i do this the values in the drop down gets reset while the others in the text boxes don't. How do i retain the values
PHP Returning Values from Function
Returnig Values from function: From a function we can return values using optional return statement, in PHP we can return arrays, objects. With the help... of the project. If we do not put any return statement then a NULL value is returned
insertion sort
insertion sort  write a program in java using insertion sort

Ads