Jump to content

Browser Crashes on simple script. [solved]


Fuego

Recommended Posts

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 sure
unset($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 box
if(!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

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){
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.