riddhi Posted April 23, 2007 Share Posted April 23, 2007 echo "<form name='form1' method='get' action='cart.php?action=view'onSubmit=' <? for($i=0; $i < count($productId); $i++){ $_GET['p']=$productId[$i]; addToCart(); } $_GET['action']='view'; ?> >'"; echo "<input name='cart' type='submit' value='Add To Cart' />"; echo "</form>"; The line $_GET['p']=$productId[$i]; is giving this message Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in f:\program files\easyphp1-8\www\plaincart\budget.php on line 145 Link to comment https://forums.phpfreaks.com/topic/48232-where-is-the-problem-simple/ Share on other sites More sharing options...
genericnumber1 Posted April 23, 2007 Share Posted April 23, 2007 you didn't close your top echo... if you mean for it all to be in an echo then you would want to use single quotes so that php doesn't try to parse the contained variables. Link to comment https://forums.phpfreaks.com/topic/48232-where-is-the-problem-simple/#findComment-235763 Share on other sites More sharing options...
riddhi Posted April 23, 2007 Author Share Posted April 23, 2007 please make the correction is not able to understand Link to comment https://forums.phpfreaks.com/topic/48232-where-is-the-problem-simple/#findComment-235772 Share on other sites More sharing options...
boo_lolly Posted April 23, 2007 Share Posted April 23, 2007 here: echo "<form name='form1' method='get' action='cart.php?action=view'onSubmit=' <? you have an echo statement shown outside of a php header. then, you start another php header in the next line. that's where your problem is. Link to comment https://forums.phpfreaks.com/topic/48232-where-is-the-problem-simple/#findComment-235783 Share on other sites More sharing options...
Barand Posted April 23, 2007 Share Posted April 23, 2007 You can't call php code in an "onsubmit". It has to be client-side script code (eg javascript). php won't be processed until the form has been submitted to the server. Link to comment https://forums.phpfreaks.com/topic/48232-where-is-the-problem-simple/#findComment-235790 Share on other sites More sharing options...
riddhi Posted April 23, 2007 Author Share Posted April 23, 2007 what is the wy to work out ?? Link to comment https://forums.phpfreaks.com/topic/48232-where-is-the-problem-simple/#findComment-235901 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.