Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-17-2013, 02:45 PM   PM User | #16
Marifran
New Coder

 
Join Date: Mar 2013
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
Marifran is an unknown quantity at this point
New to this...

I was wondering if anyone has a simple code to make a form.

I want the form information to come to my email

I need the php code also to make it work.

I also need the form to have check boxes.

I have tried for hours and researched online, just to see parts of the form code, but not the entire code.

If anyone can help I would appreciate it.

Thank you for your time.

Have a blessed day :-) <><+



Quote:
Originally Posted by tammywal22 View Post
Thanks for the great tips!

I love this point.
"Sanitise your SQL. Use mysql_real_escape_string() or equivalent."

Maybe a new thread about php security is also very helpful for many of us!
Marifran is offline   Reply With Quote
Old 03-25-2013, 10:05 AM   PM User | #17
BiztechExperts
New to the CF scene

 
Join Date: Feb 2013
Location: India
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
BiztechExperts is an unknown quantity at this point
Like the whole thing else in life you should learn as much as you can concerning the tools you are working with, and it takes a lot of time to become a better developer in any programming language, so be patience and remember, common sense and documentation are your best allies.
BiztechExperts is offline   Reply With Quote
Old 03-30-2013, 07:55 AM   PM User | #18
siyajoshi
New to the CF scene

 
Join Date: Aug 2012
Location: New Delhi
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
siyajoshi can only hope to improve
How to write better PHP code:-

I'm not going to offer you a recipe. Instead of that here are seven of the best practices I follow to write better PHP code:

Some points:
  1. Use alternative PHP syntax in templates.
  2. Everything capsulated (separation of logic and display code; e.g. an MVC layout).
  3. Use a DB object, such as PDO.
  4. Debugging is your best friend. Helpful functions: var_dump(), die(). debug_print_backtrace(). Also review the PHP manual section on error handling.

Last edited by Inigoesdr; 03-30-2013 at 02:04 PM.. Reason: Added some more useful information
siyajoshi is offline   Reply With Quote
Old 04-01-2013, 01:51 PM   PM User | #19
annaharris
New Coder

 
Join Date: May 2012
Location: USA
Posts: 83
Thanks: 0
Thanked 4 Times in 4 Posts
annaharris is an unknown quantity at this point
Regarding PHP Code

These are really helpful guidelines for writing better PHP codes. One should always follow them to become a successful web developer.
annaharris is offline   Reply With Quote
Old 04-02-2013, 07:59 AM   PM User | #20
jasonaureliana
New to the CF scene

 
Join Date: Mar 2013
Location: Cebu City , Philippines
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jasonaureliana is an unknown quantity at this point
Smile

is PHP run by a server? what type of server ?
jasonaureliana is offline   Reply With Quote
Old 04-02-2013, 10:41 AM   PM User | #21
keeper
New to the CF scene

 
Join Date: Mar 2013
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
keeper is an unknown quantity at this point
you could use one of the so many available php framework like cakephp, codeigniter, yii etc.
keeper is offline   Reply With Quote
Old 04-12-2013, 06:55 AM   PM User | #22
furki
New to the CF scene

 
Join Date: Mar 2013
Location: Lhr, Pakistan
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
furki is an unknown quantity at this point
Thanks for the tips, these tips really matters a lot as I am learning PHP now a days.
furki is offline   Reply With Quote
Old 04-22-2013, 05:30 AM   PM User | #23
Caghrlos
New to the CF scene

 
Join Date: Apr 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Caghrlos is an unknown quantity at this point
good code with less effort and time spent.
Caghrlos is offline   Reply With Quote
Old 04-23-2013, 06:58 AM   PM User | #24
Gurmeet
New Coder

 
Join Date: Mar 2013
Location: Lucknow
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Gurmeet is an unknown quantity at this point
This thread is very interesting and useful. I'm happy that I have found this thread.
Gurmeet is offline   Reply With Quote
Old 04-23-2013, 10:30 AM   PM User | #25
dedigalih
New to the CF scene

 
Join Date: Apr 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
dedigalih is an unknown quantity at this point
maybe you want to add this:

1.0 always use ini_set, 'display_errors' and error_reporting as long you develop your script, can be commented or removed when you deploy the script.

2.5. always use mysql_error to see what't wrong with your query.

4.0. develop and run shell scripts from php only if you don't have any other way to solve the problem

Last edited by vinyl-junkie; 04-23-2013 at 01:23 PM.. Reason: signatures only allowed through the control panel
dedigalih is offline   Reply With Quote
Old 04-30-2013, 10:58 AM   PM User | #26
energiefreiheit
New to the CF scene

 
Join Date: Apr 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
energiefreiheit is an unknown quantity at this point
Here's the thing. I'm using Dreamweaver CS4 to develop a website. In the past my php files would look like this:
Code:
<?php
echo '<h1>Welcome ' . $name . '</h1>';
?>This caused problems in the design view because all I would see would be the php icon to let me know I have some script in this location and that is it.

Then I started to realize that I should write my code like this:
Code:
<h1>Welcome <?php echo $name; ?></h1>This second way of writing php code is a lot easier to work with in Dreamweaver since in the design view I can see the formatted h1 tag with the word 'Welcome' beside it (followed by the php icon). I can still apply all the standard CSS rules inside Dreamweaver and the design view updates nicely.

So now here is my issue. What is the best way to handle if statements? Say I want to toggle between <h1>Welcome $user</h1> and <h2>Good bye</h2> BUT I would like to still be able to format the CSS and see the results on the screen in design view. Is it possible?

Here's the thing. I'm using Dreamweaver CS4 to develop a website. In the past my php files would look like this:
Code:
<?php
echo '<h1>Welcome ' . $name . '</h1>';
?>This caused problems in the design view because all I would see would be the php icon to let me know I have some script in this location and that is it.

Then I started to realize that I should write my code like this:
Code:
<h1>Welcome <?php echo $name; ?></h1>This second way of writing php code is a lot easier to work with in Dreamweaver since in the design view I can see the formatted h1 tag with the word 'Welcome' beside it (followed by the php icon). I can still apply all the standard CSS rules inside Dreamweaver and the design view updates nicely.

So now here is my issue. What is the best way to handle if statements? Say I want to toggle between <h1>Welcome $user</h1> and <h2>Good bye</h2> BUT I would like to still be able to format the CSS and see the results on the screen in design view. Is it possible?
energiefreiheit is offline   Reply With Quote
Old 05-06-2013, 10:13 AM   PM User | #27
amish159
New to the CF scene

 
Join Date: May 2013
Location: Ahmedabad
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
amish159 is an unknown quantity at this point
Thank you for sharing your experiences . I Hope Peoples make us inform about their Experiences in web developing , like you did.
amish159 is offline   Reply With Quote
Old 05-07-2013, 11:10 AM   PM User | #28
johnmacklen
New Coder

 
Join Date: Apr 2013
Posts: 26
Thanks: 1
Thanked 3 Times in 3 Posts
johnmacklen is an unknown quantity at this point
Thumbs up Reply: How to write better PHP code



Hello there,

For writing better PHP Codes implement this some simple rules as follows...
Following points you should keep in your mind while developing php website.


1 - Commenting & Documentation
2 - Consistent Indentation
3 - Avoid Obvious Comments
4 - Code Grouping
5 - Consistent Naming Scheme
6 - DRY Principle(DRY stands for Don’t Repeat Yourself. Also known as DIE: Duplication is Evil.)
7 - Avoid Deep Nesting
8 - Limit Line Length
9 - File and Folder Organization
10 - Consistent Temporary Names
11 - Capitalize SQL Special Words
12 - Separation of Code and Data
13 - Alternate Syntax Inside Templates
14 - Object Oriented vs. Procedural
15 - Read Open Source Code
16 - Code Refactoring


johnmacklen is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:42 PM.


Advertisement
Log in to turn off these ads.