TrillionBuks Posted March 10, 2008 Share Posted March 10, 2008 I am brand new to php. How do I test the code that I have written? Any advice is appreciated.Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/ Share on other sites More sharing options...
unsider Posted March 10, 2008 Share Posted March 10, 2008 Upload it too a web server, particularly Apache with updated PHP/mySQL, Or use your localhost. phpMyAdmin is good for interacting with your DB. umm, just google some of those terms and you're bound to string it together. Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489001 Share on other sites More sharing options...
stublackett Posted March 10, 2008 Share Posted March 10, 2008 In what way!? If your totally starting new, You need a localhost or a hosting account I'd reccomend doing a google for "WAMP" which creates a PHP / MySQL Server for you If you mean if your testing variables etc, Your best doing an echo statement of that variable i.e : echo $variable; Your post seems to be too generic to be able to give you a proper answer though Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489003 Share on other sites More sharing options...
EY Posted March 11, 2008 Share Posted March 11, 2008 XAMPP is an also good way. Or you can find a free host that offers FTP and upload them and see what it does. Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489016 Share on other sites More sharing options...
amarques Posted March 11, 2008 Share Posted March 11, 2008 WAMP or any other local server is your best way to begin with. You can safely test your code locally before uploading it. Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489018 Share on other sites More sharing options...
dotBz Posted March 11, 2008 Share Posted March 11, 2008 You can also test your PHP codes by just using php.exe or phpcli.exe. But that would be for php codes only.. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489020 Share on other sites More sharing options...
TrillionBuks Posted March 11, 2008 Author Share Posted March 11, 2008 In what way!? If your totally starting new, You need a localhost or a hosting account I'd reccomend doing a google for "WAMP" which creates a PHP / MySQL Server for you If you mean if your testing variables etc, Your best doing an echo statement of that variable i.e : echo $variable; Your post seems to be too generic to be able to give you a proper answer though Iam creating an form with four fields and I want to see how it looks when executed. In addition I wasnt to test the email and phone number verification. Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489022 Share on other sites More sharing options...
peranha Posted March 11, 2008 Share Posted March 11, 2008 In what way!? If your totally starting new, You need a localhost or a hosting account I'd reccomend doing a google for "WAMP" which creates a PHP / MySQL Server for you If you mean if your testing variables etc, Your best doing an echo statement of that variable i.e : echo $variable; Your post seems to be too generic to be able to give you a proper answer though XAMPP is an also good way. Or you can find a free host that offers FTP and upload them and see what it does. As stated above, being new, do a google search for WAMP and XAMP, and install one of these locally on your machine. This will install everything that you need to test codes. They are installers, so you dont need to change setting manually if you dont want to. Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489026 Share on other sites More sharing options...
TrillionBuks Posted March 11, 2008 Author Share Posted March 11, 2008 I installed WAMP and it gives me an error when I try to put it online. "the service has not been started". I start all services but nothing happens. I am trying to test the following code. Can anyone help or review my code for errors? Thanks. <?php if (isset($_POST['first_name']) && isset($_POST['last_name']) && isset($_POST['email']) && isset($_POST['phone']) && !empty($_POST['first_name']) &7 !empty($_POST['last_name']) && !empty($_POST['email']) && !empty($_POST['phone')) { $errors = array(); if (!ereg("^[^@ ]+@[^@ ]+\.[^@ ]+$", $_POST['email']) { $errors[] = "Invalid E-Mail Address!"; } if (!ereg("((\(\d{3}\)?)|(\d{3}))([\s-./]?)(\d{3})([\s-./]?)(\d{4})", $_POST['phone']) { $errors[] = "Invalid Phone Number!"; } if (!empty($errors)) { foreach ($errors as $error) { echo $error . "<br />"; } } else { echo "First Name: " . $_POST['first_name'] . "<br />"; echo "Last Name: " . $_POST['last_name'] . "<br />"; echo "E-Mail : " . $_POST['email'] . "<br />"; echo "Phone: " . $_POST['phone'] . "<br />"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489045 Share on other sites More sharing options...
atravotum Posted March 11, 2008 Share Posted March 11, 2008 This may be a bit much but what I do to test my code is upload it to my web host. There are providers out their that offer free hosting if you own a domain name. I use godaddy, buy a .info or something for like $4 and get a free hosting account for the year. Just make sure to pick linux to test the php, found that out the hard way! But $4 a yr for a workable environment i thought was pretty good. Lol plus you would be a customer so you can always call and complain when something breaks Quote Link to comment https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489048 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.