my code

Snippet options

Download: Download snippet as update-record.html.
Copy snippet: For this you need a free my code account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<!------UPDATE FORM---------->           


if (isset ($_POST['cancel'])){

if (isset ($_POST['submit'])){

//Data Validation
		$check_data = "SELECT * FROM stud_record WHERE stud_no='$stud_no' OR contact_no='$contact_no' OR email='$email'";
		$run = mysql_query($check_data);
		if (mysql_num_rows($run)>0){
			while ($rst = mysql_fetch_array($run)){
			//Is it username or email?
				if ($rst["stud_no"] == $_POST['stud_no']){
				$csn = "<td style = 'color:red;'>Student No: $stud_no is already in use.</td>";
				if ($rst["contact_no"] == $_POST['contact_no']){
				$ccn = "<td style = 'color:red;'>Contact No: $contact_no is already in use.</td>";
				if ($rst["email"] == $_POST['email']){
				$cemail = "<td style = 'color:red;'>Email $email is already in use.</td>";
//Data Validation End			
			mysql_query("UPDATE stud_record SET stud_no='$stud_no',fname='$fname',lname='$lname',course='$course',contact_no='$contact_no',email='$email' WHERE id='$id'");

Create a free my code account now.

my code is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.