chanchelkumar Posted December 7, 2007 Share Posted December 7, 2007 Hi dudes, I am working with a form which is having four button images, having the same name. But the the values are different, i want the values to redirect the page from the action page. Now the problem is the button value is not getting in the action page of IE... No problem in Firefox... Any idea about this error!!!!! Please help me..... <table width="100%" height="34" border="0" cellpadding="0" cellspacing="0" class="subtitle1"> <tr> <td width="7%" height="34" align="left" valign="middle">select</td> <td width="3%" align="left"> <input type="checkbox" name="checkall" value="checkall" id="checkall" disabled="disabled" ></td> <td width="2%" valign="middle" align="left">to</td> <td width="14%" align="right"> <!--a href="contactuser.php?es_type=1"--> <input type="image" src="images/content_tabs_1.gif" border="0" name="con_submit" value="Contact Now" id="con_submit"/></td> <td width="2%" valign="middle" align="center">or</td> <td width="72%" align="left"> <input type="image" src="images/content_tabs_2.gif" border="0" id="con_submit" name="con_submit" value="basket" /></td> </tr> </table> In this code there is only two buttons, but another pair is also in my page with the same code.... Am getting the value in the action page as $_request['con_submit']; By the value of the button i want o redirect the page... Please help me... Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted December 7, 2007 Share Posted December 7, 2007 Where is your PHP code, and your Form ? Quote Link to comment Share on other sites More sharing options...
chanchelkumar Posted December 7, 2007 Author Share Posted December 7, 2007 Okkk <form name="massInquiry" id="massInquiry" action="masscart.php" method="post"> <table width="100%" class="subtitle1"> <tr> <td width="5%" valign="middle" align="left"> select</td> <td width="3%" align="left"> <input type="checkbox" name="check_all" value="checkall" id="check_all" disabled="disabled"> <!--<input type="checkbox" name="checker[]" id="checker[]" value="<? //echo $offer['es_id']?>"> --> </td> <td width="2%" valign="middle" align="left">to</td> <td width="12%" align="right"><!--a href="contactuser.php?es_type=1"--> <input type="image" src="images/content_tabs_1.gif" border="0" id="con_submit" value="contact"/></td> <td width="2%" valign="middle" align="left">or</td> <td width="76%" align="left"> <input type="image" src="images/content_tabs_2.gif" border="0" id="con_submit" name="con_submit" value="basket" /></td> </tr> </table> </form> And my php code <?php include_once('myconnect.php'); if( !isset($_REQUEST["browse"]) ||($_REQUEST["browse"]=="")) { header("Location: gen_confirm.php?errmsg=".urlencode("Invalid access, denied")); die(); } $browse=$_REQUEST["browse"]; $chck_cnt=$_REQUEST["cnt"]; $buttonvalue=$_REQUEST["con_submit"]; $browse.$chck_cnt; //die(); //for($i=0;$i<$chck_cnt;$i++) echo $_REQUEST["check_".$i]; //die(); include_once "logincheck.php"; if ($buttonvalue=='basket') { header("Location:"."cart_items.php"); die(); } else if($buttonvalue=='contact') { header("Location:"."inquire_all.php"); die(); } //=======================maintaining cart items======================================= ?> Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 7, 2007 Share Posted December 7, 2007 This will solve your problem - http://www.php.net/manual/en/faq.html.php#faq.html.form-image Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted December 7, 2007 Share Posted December 7, 2007 Try like this <?php $browse=$_REQUEST["browse"]; $chck_cnt=$_REQUEST["cnt"]; $buttonvalue=$_REQUEST["con_submit"]; if($_SERVER['REQUEST_METHOD'] == 'POST') { switch ($buttonvalue) { case "basket": header("Location:"."cart_items.php"); break; case "contact": header("Location:"."inquire_all.php"); break; } } ?> Quote Link to comment Share on other sites More sharing options...
chanchelkumar Posted December 7, 2007 Author Share Posted December 7, 2007 but ~n[EO]n~.. The $buttonvalue is not getting in IE Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted December 7, 2007 Share Posted December 7, 2007 Then you can do one thing <?php // after you press the button if($_SERVER['REQUEST_METHOD'] == 'POST') { // get the button value here $browse=$_REQUEST["browse"]; $chck_cnt=$_REQUEST["cnt"]; $buttonvalue=$_REQUEST["con_submit"]; // and proceed with your redirect stuff ?> When I used Image field as button, it didn't work in IE until I used $_SERVER['REQUEST_METHOD'] == 'POST' Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 7, 2007 Share Posted December 7, 2007 Both of you please read the link I posted above to the php manual. Image submit buttons set an x and y variable that in php is converted to name_x and name_y. Quote Link to comment Share on other sites More sharing options...
chanchelkumar Posted December 7, 2007 Author Share Posted December 7, 2007 PFMaBiSmAd..... i read it ... thanks... am working on that.... It's little bit complicate with my four images and one name... that's why i am searching a easy one... Quote Link to comment Share on other sites More sharing options...
chanchelkumar Posted December 7, 2007 Author Share Posted December 7, 2007 ~n[EO]n~..... still same problem... ?? Quote Link to comment Share on other sites More sharing options...
chanchelkumar Posted December 10, 2007 Author Share Posted December 10, 2007 yes .... still same problem.. I think that ugly button will be the only solution.... Any other idea?????/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.