is it possible with in one form more than 1 submit buttons | Member | | Join Date: Aug 2007
Posts: 120
| |
Hi everybody,
Hi iam strugling with more than one submit buttons with in one form
here is my code -
<form method="post" action="Offer.php" name='issueFrm' onSubmit="return fullOfferfields();">
-
OFFER <input type=image src="amarok_rewind.png " title="rewind" > <input type=image src="amarok_back.png" title="back"> <input type="text" size=3 name='txt'> <input type=image src="amarok_next.png " title="next" > <input type=image name='frwd' src=
-
"amarok_fastforward.png" title="fastforward" value='submit' alt='fastforward'>
-
<input type=submit name=ss value=Submit>
-
</form>
-
-
once i clicked on image submit button it has to post some data.
-
this one working on Mozilla browser what is the problem could you explain me
-
and here is my entire code
-
-
-
code:
-
<html>
-
<body>
-
<table>
-
<tr height=1>
-
<td width=100% align=center class="pageheader" background="sidebar.gif" colspan=8 cellpadding=0 cellspacing=0>
-
<form method="post" action="Offer.php" name='issueFrm' onSubmit="return fullOfferfields();">
-
OFFER  
-
;
-
-
-
-
-
-
-
-
-
<input type=image src="amarok_rewind.png " title="rewind" > <input type=image src="amarok_back.png" title="back"> <input type="text" size=3 name='txt'> <input type=image src="amarok_next.png " title="next" > <input type=image name='frwd' src=
-
"amarok_fastforward.png" title="fastforward" value='Submit' alt='fastforward'>
-
</td>
-
</tr>
-
</hr>
-
<?php
-
#$cxn = mysql_connect("localhost","root","mysql");
-
#$db = mysql_select_db("phoenixhrdb",$cxn);
-
include_once("functions.php");
-
$cxn = connect_to_db("vars.php");
-
#echo $cxn;
-
echo $_POST['frwd'];
-
if(isset($_POST['frwd']) or !empty($_POST['frwd'])){
-
$query="select Max(ID) as id from Offer";
-
echo $query;
-
$result=mysql_query($query,$cxn);
-
$row=mysql_fetch_array($result);
-
$id=$row['id'];
-
#echo $id;
-
$all_query="select * from Offer where ID='$id'";
-
$all_result=mysql_query($all_query,$cxn);
-
$all_row=mysql_fetch_array($all_result);
-
$all_id=$all_row['Position_Name'];
-
#echo $all_id;
-
$all_client=$all_row['Client'];
-
#echo $all_client;
-
$all_candidate=$all_row['Candidate'];
-
#echo $all_candidate;
-
$all_desig=$all_row['Designation'];
-
#echo $all_desig;
-
$all_expdate=$all_row['Company_Exp_Doj'];
-
$all_offer=$all_row['Offer_date'];
-
#echo $all_offer;
-
$all_offerctc=$all_row['offer_CTC'];
-
#echo $all_offerctc;
-
$all_status=$all_row['Status'];
-
#echo $all_status;
-
-
}
-
?>
-
<tr>
-
<td colspan=7 width=100% height=100%>
-
<table border=0 width=100% height=100%>
-
<tr width=100% height=100%>
-
<td colspan=7 width=80% height=100%>
-
<table border=0 width=100% height=100%>
-
<tr width=100% height=100%>
-
<td width=25% height=100% valign=top>
-
<SCRIPT language=JavaScript id=jscal1xx>
-
var cal1xx = new CalendarPopup("testdiv1");
-
cal1xx.showNavigationDropdowns();
-
</SCRIPT>
-
-
<table width=95% align=center cellpadding=4 cellspacing=0 border=0>
-
<tr><td></td></tr>
-
<tr><td colspan=8 class="field" background="sidebar.gif"><u>Offer Details</u></td></tr>
-
<tr><td></td></tr>
-
<tr><td class="field">Client Name <font color="red">*</font></td><td><select id='department' name="CCode" onChange='load()' >
-
<?php
-
-
#$cxn = mysql_connect("localhost","root","mysql");
-
-
#$db = mysql_select_db("phoenixhrdb",$cxn);
-
-
$CName_query = "select Client_Name from Client";
-
-
$CName_result = mysql_query($CName_query) or die("Could not connect to database".mysql_error($cxn));
-
-
while($Crow = mysql_fetch_array($CName_result)){
-
$clientname[] = $Crow['Client_Name'];
-
-
-
}
-
for($i=0; $i< sizeof($clientname); $i++)
-
-
{
-
-
echo "<option value='$clientname[$i]'";
-
-
if($clientname[$i] == @$_POST['CCode']){
-
-
echo "selected";
-
-
}
-
-
echo "> $clientname[$i]</option>";
-
-
}
-
-
-
-
?>
-
-
-
</select>
-
-
</td></tr>
-
-
<tr><td class="field">Position Name <font color="red">*</font></td>
-
-
<td>
-
-
<?php
-
-
echo ("<select id='faculty', name='PCode' selected >");
-
$n=$_POST{'PCode'};
-
echo "<option value='$n'>";
-
-
# echo "selected";
-
-
-
echo " $n</option>";
-
-
echo ("</select>");
-
-
#iecho $n;
-
?>
-
-
</td></tr>
-
-
<tr><td class="field">Candidate Name <font color="red">*</font></td><td>
-
<?php
-
$candquery = "select distinct Candidate_Name from Interview where I_status='Confirmed' ;";
-
$candresult = mysql_query($candquery,$cxn);
-
while($candrow = mysql_fetch_array($candresult)) {
-
$candname[] = $candrow['Candidate_Name'];
-
}
-
?>
-
<select name="canname" >
-
<?php
-
if(isset($_POST['frwd'])){
-
echo"<option value='<?php echo $all_candidate;' ?>$all_candidate</option>";}
-
$i=0;
-
while($i<sizeof($candname)) {
-
-
if($all_candidate==$candname[$i]){$i++;}
-
echo ("<option value='$candname[$i]'>$candname[$i]</option>");
-
$i++;
-
}
-
?>
-
</select>
-
</td>
-
</tr>
-
-
<tr><td class="field" >Designation </td><td>
-
-
-
<select name="designation" >
-
<?php
-
include("designation.inc");
-
?>
-
</td></tr>
-
<?php
-
if(isset($_POST['frwd'])){
-
echo "<tr><td class='field'>Expected date of joining </td><td><input type='text' name='exdoj' size='7' readonly title='Select Date' value='$all_expdate'>";
-
}
-
else{
-
echo "<tr><td class='field'>Expected date of joining </td><td><input type='text' name='exdoj' size='7' readonly title='Select Date'>";}
-
?>
-
<a id=anchor2xx onclick="cal1xx.select(document.forms[0].exdoj,'anchor2xx','dd/MM/yyyy'); return false;"
-
href="http://www.mattkruse.com/javascript/calendarpopup/index.html#"
-
-
name=anchor2xx><img src="cal.gif"></img></a>
-
</td></tr>
-
<?php
-
if(isset($_POST['frwd'])){
-
echo "<tr><td class='field'>Offer date </td><td><input type='text' name='ofd' size='7' readonly title='Select Date' value='$all_offer'>";
-
}
-
else{
-
echo "<tr><td class='field'>Offer date </td><td><input type='text' name='ofd' size='7' readonly title='Select Date'>";}
-
?>
-
<a id=anchor1xx
-
title="cal1xx.select(document.forms[0].ofd,'anchor1xx','dd/MM/yyyy'); return false;"
-
onclick="cal1xx.select(document.forms[0].ofd,'anchor1xx','dd/MM/yyyy'); return false;"
-
href="http://www.mattkruse.com/javascript/calendarpopup/index.html#"
-
-
name=anchor1xx><img src="cal.gif"></img></a> </td></tr>
-
<tr><td colspan='2' align='right'></td></tr>
-
<tr><td class="field">Offer CTC </td><td><select name="offctc" >
-
-
<?php
-
$i=0;
-
if(isset($_POST['frwd'])){
-
echo("<option value='$all_offerctc' selected>$all_offerctc</option>");}
-
-
while($i<=50){
-
-
#if(isset($_POST['frwd'])){
-
#echo("<option value='$all_offerctc' selected>$all_offerctc</option>");}
-
if($all_offerctc==$i){$i++;}
-
if($i==0) {
-
-
echo ("<option value='$i'>Select</option>");
-
}
-
else {
-
#for($i=0; $i<=sizeof($exp_salary); $i++) {
-
-
echo ("<option value='$i'>$i</option>");
-
-
# }
-
}
-
$i=$i+0.5;
-
}
-
-
?>
-
</select>
-
-
</td></tr>
-
<tr><td class="field">Status </td>
-
<td><select name="st">
-
<?php
-
if(isset($_POST['frwd'])){
-
echo"<option value='$all_status' selected>$all_status</option>";
-
}
-
$a=0;
-
$arr=array("Accepted","Rejected","Joined");
-
while($a<sizeof($arr)){
-
if($all_status==$arr[$a]){$a++;}
-
echo"<option value='$arr[$a]'>$arr[$a]</option>";
-
$a++;
-
}
-
?>
-
</select>
-
</td></tr>
-
-
<tr><td></td></tr>
-
<tr><td colspan=3 align=center><input type="submit" name="offersubmit" value="Submit"></td></tr>
-
-
</table>
-
</form>
-
-
<tr height=15><td align=center background="sidebar.gif" colspan=8 cellpadding=0 cellspacing=0 class=footertxt>copyright2007 @ phoenixhrsolutions</td></tr>
-
</table>
-
-
</body>
-
</html>
-
|  | Moderator | | Join Date: Jul 2006 Location: The Netherlands
Posts: 4,139
| | | re: is it possible with in one form more than 1 submit buttons
Next time enclose any code within the proper code tags. See the Posting Guidelines on how to do that.
moderator
| | Newbie | | Join Date: Oct 2007 Location: MN
Posts: 6
| | | re: is it possible with in one form more than 1 submit buttons
In your code you are using isset['frwrd'] to check if the image button was clicked. When you are using that type of button, the post value, at least in Firefox, is not called frwrd. There are two post values frwrd_x and frwrd_y which indicate the location on the image where the user clicked. You could change your input type to a submit button and style it's appearance if you'd like to avoid rewriting some of your PHP code.
| | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,295 network members.
|