how to use two buttons with php


Posted on 16th Feb 2014 07:03 pm by admin

hi i have one form. there are three fields which are to be filled by the user. and then there are two buttons. ob clicking first button i want to save user's provided data to the database display the same page again. and on clicking second button the provided data will be saved and will be taken to next page.

my problem is with these buttons how can i set up these buttons to do the the action?

Did you know?Explore Trending and Topic pages for more stories like this.
my code is here
Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>

<body>
<form name="form1" method="post" action="">
<label>Degree Name:
<input type="text" name="textfield" id="textfield">
</label>
<p>
<label>CGPA:
<input type="text" name="textfield2" id="textfield2">
</label>
</p>
<p>
<label>Institute:
<input type="text" name="textfield3" id="textfield3">
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Save And Add Another">
</label>
</p>
<p>
<label>
<input type="submit" name="button2" id="button2" value="Save And Proceed to Next Step">
</label>
</p>
</form>
<?php
$db = mysql_connect("localhost");
mysql_select_db("job", $db);
$addcv = mysql_query("insert into cv
(
degree,
cgpa,
institute
)
values
(
'".$degree."',
'".$cgpa."',
'".$institute."',
)");
echo "Your data is added.";
?>
</body>
</html>
No comments posted yet

Your Answer:

Login to answer
144 Like 24 Dislike
Previous forums Next forums
Other forums

Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I

Multidimensional Array into an Html table, help!
Hello all, I am new to HTML/PHP so any help would be great.

I have a multidimensional array f

can i optmize image to 50% quality before uploading 2 server
Hi there

i have jus written a php program to upload and display images but when i try to uplo

Final year project, please point me in the right direction
hi there for my final year project I'm aiming to build a php script shell to use as an expert system

Validating time
Hi Guys

what do you think of the following approach to validate a 24hour time:

http://

Header redirect
Hello ive got a problem ive got form with its action set to itself.
Code: <form id="f

Check Date/Time in PHP
What I need the code to check is that $reQuest is 24 hours in the past then return a time based on h

Different payment methods with different cross company requirements in F110
We are implementing SAP in a company in the shipping industry. They have the following requirement:<

How many users online in the last 24-hours using time()?
I'm fairly new to PHP. I have a MySQL table called 'users' and a field called 'loggedin' which is in

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash