Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP do not repeat values in databse during insertion using php and javascript
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Sharada ananya
do not repeat values in databse during insertion using php and javascript
0 Answer(s)      3 years ago
Posted in : PHP


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>

Advertisement
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
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: import
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 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
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: 
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
PHP SQL Insertion
PHP SQL Insertion       PHP SQL Insertion is used to execute MySQL queries in PHP script.... Understand with Example The Tutorial illustrate an example from 'PHP SQL Insertion
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
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
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
php do while loop
php do while loop  Difference between do while loop and simple loop in PHP
php do while example
php do while example  Simple example of do while loop in PHP
php do while syntax
php do while syntax  How to create a do while loop in php. What is the syntax
php do while false
php do while false   Is there any difference between FALSE and false
php do while break
php do while break   receiving a Fatal saying cannot break/continue.. please suggest. Thank U
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.
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
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. <
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
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
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
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
JavaScript in PHP Loop
JavaScript in PHP Loop  i wants to know how to implement the JavaScript code into the PHP Loop function. Thanks
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
Advertisements
 

 

 

DMCA.com