Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489003
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489022
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489026
Share on other sites

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 />";

}

}

?>

Link to comment
https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489045
Share on other sites

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 ^_^

Link to comment
https://forums.phpfreaks.com/topic/95525-how-do-i-test-my-code/#findComment-489048
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.