3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $nameErr= $surnameErr = ""; $name= $surname = ""; $errors= ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if(empty($_POST['customer_name'])){ $errors[] = "Please provide with name"; } if(count($errors)>0) $errors = implode('<br />',$errors); } ?> <!DOCTYPE HTML> <html> <head> <meta content="text/javascript"/> <link rel="stylesheet" type="text/css" href="css/blitzer/backsty.css"> <script type="text/javascript"> window.onload=function(){ var tfrow = document.getElementById('tfhover').rows.length; var tbRow=[]; for (var i=1;i<tfrow;i++) { tbRow[i]=document.getElementById('tfhover').rows[i]; tbRow[i].onmouseover = function(){ this.style.backgroundColor = '#F6D4D4'; }; tbRow[i].onmouseout = function() { this.style.backgroundColor = '#EB8686'; }; } }; </script> <script type="text/javascript"> function confirm_click(customer_name) { return confirm("Are you sure you want to delete "+ customer_name +" from the database ?"); } /* function validateEmail() { var emailID = document.userForm.customer_email.value; atpos = emailID.indexOf("@"); dotpos = emailID.lastIndexOf("."); if (atpos < 1 || ( dotpos - atpos < 2 )) { alert("Please provide correct email ID") document.userForm.customer_email.focus() ; return false; } return( true ); } function validatePost() { var postID = document.userForm.customer_post.value; regPostcode = /^([a-zA-Z]){1}([0-9][0-9]|[0-9]|[a-zA-Z][0-9][a-zA-Z]|[a-zA-Z][0-9][0-9]|[a-zA-Z][0-9]){1}([ ])([0-9][a-zA-z][a-zA-z]){1}$/; if(regPostcode.test(postID) == false) { alert("Please provide the correct Postcode"); document.userForm.customer_post.focus() ; return false; } return ( true ) ; } function validate() { if( document.userForm.customer_name.value == "" ) { alert("Please provide the customer name!"); document.userForm.customer_name.focus() ; return false; } if( document.userForm.customer_surname.value == "" ) { alert( "Please provide the customer surname!" ); document.userForm.customer_surname.focus() ; return false; } if( document.userForm.customer_email.value == "" ) { alert( "Please provide the correct Email!" ); document.userForm.customer_email.focus() ; return false; }else{ var ret = validateEmail(); if( ret == false ) { return false; } } if( document.userForm.address_line_1.value == "") { alert( "Please provide the correct address" ); document.userForm.address_line_1.focus() ; return false; } if( document.userForm.customer_post.value == "" ) { alert( "Please provide the correct postcode!" ); document.userForm.customer_post.focus() ; return false; }else{ var ret = validatePost(); if( ret == false ) { return false; } } if( document.userForm.customer_county.value == "0" ) { alert( "Please provide your county!" ); document.userForm.customer_username.focus() ; return false; } if( document.userForm.customer_username.value == "" ) { alert( "Please provide a valid Username!" ); document.userForm.customer_username.focus() ; return false; } var passw = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/; if(document.userForm.customer_password.value.match(passw)) { return true; } else { alert('Please provide a valid password which contains 6 to 20 characters which contain at least one numeric digit, one uppercase and one lowercase letter.') return false; } } */ </script> </head> <body> <form method="LINK" ACTION="index_mod.php"> <input type="submit" class="button2" value="Admin Home" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> <h1>Customer Management</h1> </form> <div id="content"> <table> <form onsubmit="return(validate());" name="userForm" method="post" autocomplete="off"> <tr> <td>Name</td> <td><input type="text" class="textbox" name="customer_name" /></td><td><span class="error">* <?php echo $errors;?></span> </td> </tr><tr> <td>Surname</td> <td><input type="text" class="textbox" name="customer_surname" /></td> </tr><tr> <td>Email</td> <td><input type="text" class="textbox" name="customer_email" /></td> </tr><tr> <td>Address1</td> <td><input type="text" class="textbox" name="address_line_1" /></td> </tr><tr> <td>Address2</td> <td><input type="text" class="textbox" name="address_line_2" /></td> </tr><tr> <td>Post code</td> <td><input type="text" class="textbox" name="customer_post" /></td> </tr><tr> <td>County<td> <select class="textbox" name="customer_county"> <option value="0">Please select</option> <option value="Aberdeenshire">Aberdeenshire</option> <option value="Anglesey">Anglesey</option> <option value="Angus (Forfarshire)">Angus (Forfarshire)</option> <option value="Antrim">Antrim</option> <option value="Argyll">Argyll</option> <option value="Armagh">Armagh</option> <option value="Avon">Avon</option> <option value="Ayrshire">Ayrshire</option> <option value="Banffshire">Banffshire</option> <option value="Bedfordshire">Bedfordshire</option> <option value="Berkshire">Berkshire</option> <option value="Berwickshire">Berwickshire</option> <option value="Brecknockshire">Brecknockshire</option> <option value="Buckinghamshire">Buckinghamshire</option> <option value="Bute">Bute</option> <option value="Caernarfonshire">Caernarfonshire</option> <option value="Caithness">Caithness</option> <option value="Cambridgeshire and Isle of Ely">Cambridgeshire and Isle of Ely</option> <option value="Cambridgeshire">Cambridgeshire</option> <option value="Cardiganshire">Cardiganshire</option> <option value="Carmarthenshire">Carmarthenshire</option> <option value="Cheshire">Cheshire</option> <option value="City of Aberdeen">City of Aberdeen</option> <option value="City of Belfast">City of Belfast</option> <option value="City of Bristol">City of Bristol</option> <option value="City of Dundee">City of Dundee</option> <option value="City of Edinburgh">City of Edinburgh</option> <option value="City of Glasgow">City of Glasgow</option> <option value="City of London">City of London</option> <option value="City of Londonderry">City of Londonderry</option> <option value="Clackmannanshire">Clackmannanshire</option> <option value="Cleveland">Cleveland</option> <option value="Clwyd">Clwyd</option> <option value="Cornwall">Cornwall</option> <option value="County">County</option> <option value="Cromartyshire">Cromartyshire</option> <option value="Cumberland">Cumberland</option> <option value="Cumbria">Cumbria</option> <option value="Denbighshire">Denbighshire</option> <option value="Derbyshire">Derbyshire</option> <option value="Devon">Devon</option> <option value="Dorset">Dorset</option> <option value="Down">Down</option> <option value="Dumfriesshire">Dumfriesshire</option> <option value="Dunbartonshire (Dumbarton)">Dunbartonshire (Dumbarton)</option> <option value="Durham">Durham</option> <option value="Dyfed">Dyfed</option> <option value="East Lothian (Haddingtonshire)">East Lothian (Haddingtonshire)</option> <option value="East Suffolk">East Suffolk</option> <option value="East Sussex">East Sussex</option> <option value="Essex">Essex</option> <option value="Fermanagh">Fermanagh</option> <option value="Fife">Fife</option> <option value="Flintshire">Flintshire</option> <option value="Glamorgan">Glamorgan</option> <option value="Gloucestershire">Gloucestershire</option> <option value="Greater London">Greater London</option> <option value="Greater Manchester">Greater Manchester</option> <option value="Gwent">Gwent</option> <option value="Gwynedd">Gwynedd</option> <option value="Hampshire (County of Southampton)">Hampshire (County of Southampton)</option> <option value="Hereford and Worcester">Hereford and Worcester</option> <option value="Herefordshire">Herefordshire</option> <option value="Hertfordshire">Hertfordshire</option> <option value="Humberside">Humberside</option> <option value="Huntingdon and Peterborough">Huntingdon and Peterborough</option> <option value="Huntingdonshire">Huntingdonshire</option> <option value="Inverness-shire">Inverness-shire</option> <option value="Isle of Ely">Isle of Ely</option> <option value="Isle of Wight">Isle of Wight</option> <option value="Kent">Kent</option> <option value="Kincardineshire">Kincardineshire</option> <option value="Kinross-shire">Kinross-shire</option> <option value="Kirkcudbrightshire">Kirkcudbrightshire</option> <option value="Lanarkshire">Lanarkshire</option> <option value="Lancashire">Lancashire</option> <option value="Leicestershire">Leicestershire</option> <option value="Lincolnshire, Parts of Holland">Lincolnshire, Parts of Holland</option> <option value="Lincolnshire, Parts of Kesteven">Lincolnshire, Parts of Kesteven</option> <option value="Lincolnshire, Parts of Lindsey">Lincolnshire, Parts of Lindsey</option> <option value="Lincolnshire">Lincolnshire</option> <option value="London">London</option> <option value="Londonderry">Londonderry</option> <option value="Merionethshire">Merionethshire</option> <option value="Merseyside">Merseyside</option> <option value="Mid Glamorgan">Mid Glamorgan</option> <option value="Middlesex">Middlesex</option> <option value="Midlothian (County of Edinburgh)">Midlothian (County of Edinburgh)</option> <option value="Monmouthshire">Monmouthshire</option> <option value="Montgomeryshire">Montgomeryshire</option> <option value="Moray (Elginshire)">Moray (Elginshire)</option> <option value="Nairnshire">Nairnshire</option> <option value="Norfolk">Norfolk</option> <option value="North Humberside">North Humberside</option> <option value="North Yorkshire">North Yorkshire</option> <option value="Northamptonshire">Northamptonshire</option> <option value="Northumberland">Northumberland</option> <option value="Nottinghamshire">Nottinghamshire</option> <option value="Orkney">Orkney</option> <option value="Oxfordshire">Oxfordshire</option> <option value="Peeblesshire">Peeblesshire</option> <option value="Pembrokeshire">Pembrokeshire</option> <option value="Perthshire">Perthshire</option> <option value="Powys">Powys</option> <option value="Radnorshire">Radnorshire</option> <option value="Renfrewshire">Renfrewshire</option> <option value="Ross and Cromarty">Ross and Cromarty</option> <option value="Ross-shire">Ross-shire</option> <option value="Roxburghshire">Roxburghshire</option> <option value="Rutland">Rutland</option> <option value="Selkirkshire">Selkirkshire</option> <option value="Shetland (Zetland)">Shetland (Zetland)</option> <option value="Shropshire (Salop)">Shropshire (Salop)</option> <option value="Soke of Peterborough">Soke of Peterborough</option> <option value="Somerset">Somerset</option> <option value="South Glamorgan">South Glamorgan</option> <option value="South Humberside">South Humberside</option> <option value="South Yorkshire">South Yorkshire</option> <option value="Staffordshire">Staffordshire</option> <option value="Stirlingshire">Stirlingshire</option> <option value="Suffolk">Suffolk</option> <option value="Surrey">Surrey</option> <option value="Sussex">Sussex</option> <option value="Sutherland">Sutherland</option> <option value="Tyne and Wear">Tyne and Wear</option> <option value="Tyrone">Tyrone</option> <option value="Warwickshire">Warwickshire</option> <option value="West Glamorgan">West Glamorgan</option> <option value="West Lothian (Linlithgowshire)">West Lothian (Linlithgowshire)</option> <option value="West Midlands">West Midlands</option> <option value="West Suffolk">West Suffolk</option> <option value="West Sussex">West Sussex</option> <option value="West Yorkshire">West Yorkshire</option> <option value="Westmorland">Westmorland</option> <option value="Wigtownshire">Wigtownshire</option> <option value="Wiltshire">Wiltshire</option> <option value="Worcestershire">Worcestershire</option> <option value="Yorkshire, East Riding">Yorkshire, East Riding</option> <option value="Yorkshire, North Riding">Yorkshire, North Riding</option> <option value="Yorkshire, West Riding">Yorkshire, West Riding</option> <option value="Yorkshire">Yorkshire</option> </select> </tr><tr> <td>Username</td> <td><input class="textbox" type="text" name="customer_username" id="customer_username" /><span id="user-result"></span></td> </tr><tr> <td>Password</td> <td><input class="textbox" type="text" name="customer_password" /></td> </tr><tr> <td>&nbsp;</td> <td><input type="submit" name="person" class="button1" value="add" /></td> </tr></form> - </table> </div> <script type="text/javascript" src="js/jquery-1.9.0.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#customer_username").keyup(function (e) { //removes spaces from username $(this).val($(this).val().replace(/\s/g, '')) var customer_username = $(this).val(); if(customer_username.length < 4){$("#user-result").html('');return;} if(customer_username.length >= 4){ $("#user-result").html('<img src="imgs/ajax-loader.gif" />'); $.post('check_username.php', {'customer_username':customer_username}, function(data) { $("#user-result").html(data); }); } }); }); </script> <?php // mysql_query("INSERT INTO `customers`(customer_name,customer_surname,customer_email,address_line_1,address_line_2,customer_post,customer_county,customer_username,customer_password) VALUES ('$customer_name','$customer_surname','$customer_email','$address_line_1','$address_line_2','$customer_post','$customer_county','$customer_username','$customer_password')"); } ?> </form> <div id="stock"> <?php include("db.php"); $result=mysql_query("SELECT * FROM customers"); echo "<table id='tfhover'class='tftable' border='1'>\n"; echo "<tr>\n"; echo "<th>ID</th>\n"; echo "<th>Name</th>\n"; echo "<th>Surname</th>\n"; echo "<th>Email</th>\n"; echo "<th>Adress1</th>\n"; echo "<th>Adress2</th>\n"; echo "<th>Post code</th>\n"; echo "<th>County</th>\n"; echo "<th>Username</th>\n"; echo "<th>Password</th>\n"; echo"<tr>\n"; while($test = mysql_fetch_array($result)){$id = $test['customer_id']; echo"<tr align='left'>\n"; echo"<td><font color='black'>" .$test['customer_id']. "</font></td>\n"; echo"<td><font color='black'>" .$test['customer_name']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_surname']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_email']. "</font></td>\n"; echo"<td><font color='black'>". $test['address_line_1']. "</font></td>\n"; echo"<td><font color='black'>". $test['address_line_2']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_post']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_county']. "</font></td>\n"; echo"<td><font color='black'>". $test['customer_username']."</font></td>\n"; echo"<td><font color='black'>". $test['customer_password']."</font></td>\n"; echo"<td class='link'><a class='links' href ='custdata1.php?customer_id=$id'>Edit</a></td>\n"; echo"<td class=\"link\"><a onclick=\"return confirm_click('".$test['customer_name']."');\" class='links1' href='delcustdata.php?customer_id=$id'>Delete</a></td>\n"; echo "</tr>";} echo"</table>"; mysql_close($conn);?> </div> </body> </html>
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.4.26
Parse error: syntax error, unexpected '}' in /in/2ulZd on line 352
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '}' in /in/2ulZd on line 352
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/2ulZd on line 352
Process exited with code 255.