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

Have Programming Question? Ask it here!
 
 
 


Sharada ananya
do not repeat values in databse during insertion using php and javascript
0 Answer(s)      2 years and 9 months 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
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: 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
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
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
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
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
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
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
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
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
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
Read Excel data using JSP and update MySQL databse
Read Excel data using JSP and update MySQL databse  HOw to read excel data using JSP and update MySQl database
how to put php in javascript
how to put php in javascript  How to write a javascript code inside php block
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
how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp
how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp  how to print data(From databse Oracle10g) in preformatted A4 and A3 paper using jsp. I am inserting analysis report into a database using
How can I access databse through JSP. I am using postgresql-8.4.4-1-windows as database and jboss-4.0.5.GA as server.
How can I access databse through JSP. I am using postgresql-8.4.4-1-windows as database and jboss-4.0.5.GA as server.  I am using postgresql-8.4.4-1-windows as database, jboss-4.0.5.GA as server and jdk-6-windows-i586 with IDE
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
Do..While Loops
reaches to either 5 or less than 5. <?php $i=1; do { $i++; echo &ldquo...3.10.2. Do…While Loops The do...while statement always execute the block of code once, then check the condition, and repeat the loop until
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
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
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 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... PHP Array Count Values Example 1: <?php $array=array("New","
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 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
insertion sort
insertion sort  how many arrays needed for insertion sort and why
PHP Do While Loop
Do-While Loop Function PHP: PHP Do-While loop method is another type of loop... of the variable within the loop. PHP do while loop Example: <?php $i=34; do... the code within. We generally use Do-While loop  when the iteration must run
how do i grab the url in php?
how do i grab the url in php?  I want to grab the 'entire' url, including any special characters like & and #, from a site. I then want to replace the characters with something a browser can read for example: & = %26
Date object using JavaScript
Date object using JavaScript  What's the Date object using JavaScript
Advertisements
 

 

 

DMCA.com