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
Share on other sites

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
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){
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.