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);
<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>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.