Fuego Posted November 7, 2006 Share Posted November 7, 2006 I am trying to check if any variables from a form are empty. No validation required at this stage.The last variable to go through the function causes a browser crash in IE and FF.<?//unset to be sureunset($achtung2);function checker($field) { if(empty($field)){ $result = 'Please fill in all fields!'; return($result); }} $achtung2 = checker($cashp);$achtung2 = checker($Depo);$achtung2 = checker($FirstName);$achtung2 = checker($LastName);$achtung2 = checker($CustomerEmail); // crashes on this last one, regardless of if I switch the above statements around in order. //if all data is there, pop the boxif(!isset($achtung2)){ //does stuff if there is not $achtung2 set}?> Link to comment https://forums.phpfreaks.com/topic/26395-browser-crashes-on-simple-script-solved/ Share on other sites More sharing options...
btherl Posted November 7, 2006 Share Posted November 7, 2006 What does a browser crash look like? What message do you get? Link to comment https://forums.phpfreaks.com/topic/26395-browser-crashes-on-simple-script-solved/#findComment-120723 Share on other sites More sharing options...
Fuego Posted November 7, 2006 Author Share Posted November 7, 2006 in FF I get a total crash and feedback agent starts as page explodes into a milliontiny pieces (not literaly).In IE I get a javascript error but I have rewritten it now to work.Still don't get why it was breaking before. But Ta for looking. Link to comment https://forums.phpfreaks.com/topic/26395-browser-crashes-on-simple-script-solved/#findComment-120727 Share on other sites More sharing options...
Fuego Posted November 7, 2006 Author Share Posted November 7, 2006 I ended up replacing it with this, works now :-\if(isset($url)){ if(empty($FirstName)){ $achtung2 = 'Please fill in all fields'; } if(empty($LastName)){ $achtung2 = 'Please fill in all fields'; } if(empty($CustomerEmail)){ $achtung2 = 'Please fill in all fields'; } if(empty($cashp)){ $achtung2 = 'Please fill in all fields'; } if(empty($Depo)){ $achtung2 = 'Please fill in all fields'; } //if all data is there, pop the box if(!$achtung2){ Link to comment https://forums.phpfreaks.com/topic/26395-browser-crashes-on-simple-script-solved/#findComment-120729 Share on other sites More sharing options...
btherl Posted November 7, 2006 Share Posted November 7, 2006 That's very odd.. because php is executed on the server, not in the browser. The browser cannot crash in php code. But the output displayed by a php script can cause a browser crash. It's likely that the javascript caused the crash, as javascript is run in the browser. Link to comment https://forums.phpfreaks.com/topic/26395-browser-crashes-on-simple-script-solved/#findComment-120736 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.