Re: New Error?
| From: | Marek Kilimajer | Date: | Mon, 28 Oct 2002 14:30:08 +0000 |
| Subject: | Re: New Error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121698@lists.php.net to get a copy of this message | ||
Break an continue are for loops (while,for ...), if you want to get out of a function, use return
Steve Jackson wrote:
I get this error from my code. Fatal error: Cannot break/continue 1 levels in /www/u1255/shop/purchase.php on line 22 I think I need to end the functions if a condition is met so is there a way to do it without breaking? Where do I go from here? <? include ('products_sc_fns.php'); // The shopping cart needs sessions, so start one session_start(); do_html_header("Checkout"); // if filled out //echo "testing"; if($cart&&$name&&$address&&$city&&$zip&&$country) { // able to insert into database if( insert_order($HTTP_POST_VARS)!=false ) {//display cart, not allowing changes and without pictures display_cart($cart, false, 0);calculate_weight($cart); //determine what shipping we are using if ($country!="Finland"){display_shipping(calculate_nonfinland_cost($country)); break;} elseif ($country=="Finland" && $express=="no"){display_shipping(calculate_shipping_cost($weight)); break;}elseif ($country=="Finland" && $express=="yes"){ display_shipping(calculate_express_cost($express)); break; } //de-bugecho "test & $country & $express"; //if($country!="Finland") //display_shipping(calculate_shipping_cost($weight)); //{ //display_shipping(calculate_nonfinland_cost($country)); //} //display_shipping(calculate_express_cost($express)); //display_shipping(calculate_temp_shipping_cost($weight));//get credit card detailscalculate_final_cost($total_price, $shipping); get_order_id(); display_card_form($name, $final_cost); echo "<table width='760' cellpadding='0' background='images/shopbg.gif'><tr><td width='200'> </td>";echo "<td align='right'>"; display_button("show_cart.php", "continue-shopping", "Continue Shopping"); echo "</td></tr></table>";} else { echo mysql_error(); echo "<table width='760' cellpadding='0' background='images/shopbg.gif'><tr><td width='200'> </td><td>Could not store data, please try again.</td>";echo "<tr><td width='200'> </td><td>"; display_button("checkout.php", "back", "Back");echo "</td></tr></table>"; } } else { echo "<table width='760' cellpadding='0' background='images/shopbg.gif'><tr><td width='200'> </td><td>You did not fill in all the fields, please try again.</td>"; echo "<tr><td width='200'> </td><td>"; display_button("checkout.php", "back", "Back"); echo "</td></tr></table>"; } do_html_footer(); ?> Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com <http://www.violasystems.com/> stephen.jackson@violasystems.com Mobile +358 50 343 5159