Graphic Design Forum and Web Design Forum  

Go Back   Graphic Design Forum and Web Design Forum »Web Design Forum »Programming Forum

Notices

Programming Forum Web and Software Programming Forum - Java, PHP, SQL etc.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 17-04-2008, 06:01 PM
jeffross's Avatar
Command Z aficionado
 
Join Date: Mar 2008
Location: Boise, Idaho, USA
Posts: 277
Default Adding PHP code to a WordPress blog

I'm pretty new to PHP and WordPress, and I'm looking for a little bit of assistance.

My client is wanting to add a "Country" text box to the comment form area of their blog. (Right now, we just have "Name," Email," and "Website.") Here's how that code sits right now...

HTML Code:
<input name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" type="text"><label for="author"><small>Name </small></label>

<input name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" type="text"><label for="email"><small>Mail (will not be published) </small></label>

<input name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" type="text"><label for="url"><small>Website</small></label>
Is all that's required to add this is the following code?...

HTML Code:
<input name="location" id="location" value="<?php echo $comment_location; ?>" size="22" tabindex="4" type="text"><label for="location"><small>Country </small></label>
I just want to make sure I'm not messing something up, or forgetting to add something somewhere else.

EDIT: Sorry I can't seem to get the code to show as just plain text... Any help on how to get it to show up correctly...?

Last edited by jeffross; 21-04-2008 at 10:42 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #3 (permalink)  
Old 17-04-2008, 06:24 PM
jeffross's Avatar
Command Z aficionado
 
Join Date: Mar 2008
Location: Boise, Idaho, USA
Posts: 277
Default

Something like that might work. Maybe not a drop down, but more like something they can just enter.

(So, it's a bigger task than just adding another line of code, I take it.)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #4 (permalink)  
Old 17-04-2008, 06:26 PM
Toon's Avatar
Netvibes is an Addiction™
 
Join Date: Jan 2007
Location: Sheffield, UK
Posts: 15,724
Default

I'm not sure mate, I'm not too up on Wordpress, my only take on wordpress is....if you want to do something chances are somebodies written a plugin for it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #5 (permalink)  
Old 17-04-2008, 06:29 PM
jeffross's Avatar
Command Z aficionado
 
Join Date: Mar 2008
Location: Boise, Idaho, USA
Posts: 277
Default

Cool. I'll check out that plugin then and see if it will work. Thanks Toon.

Anyone else have a suggestion/idea?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #6 (permalink)  
Old 17-04-2008, 09:46 PM
LeadMagnet's Avatar
Mr. Tambourine Man
 
Join Date: Jun 2007
Location: Ireland
Posts: 1,081
Default

More than likely your code won't work because there's nowhere in the database to store that data. Unless of course wordpress creates database entries like that as needed... but i doubt it.
__________________
Subtlety is my middle name... and first and last in case you didn't get the point.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #7 (permalink)  
Old 18-04-2008, 05:55 PM
jeffross's Avatar
Command Z aficionado
 
Join Date: Mar 2008
Location: Boise, Idaho, USA
Posts: 277
Default

Looks like I'll try out the plugin then. Thanks guys!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
  #8 (permalink)  
Old 23-04-2008, 06:31 AM
skunkbad's Avatar
Junior Member
 
Join Date: Apr 2008
Location: Temecula, California, USA
Posts: 40
Default

If there isn't a location in the database to store the data, then just make it. phpMyAdmin is really easy to use to add tables and associated fields to a MySQL database. If this is just a contact form, and the country field does not need to be stored, then just filter the country post variable value in your email processing script, and append it's value to whatever is sending the email.

As a php newbie, filtering data is one of the keys to being successful. Understanding validation and keeping your database, website, and emails safe is extremely important. Don't overlook this when adding the country field to your comment or contact form.

Here is an example of filtering data in a contact form in a php 5.2.0+ script:

PHP Code:
$name filter_input(INPUT_POST'name' FILTER_SANITIZE_STRING FILTER_FLAG_NO_ENCODE_QUOTES);
$email filter_input(INPUT_POST'email' FILTER_VALIDATE_EMAIL);
$mesg filter_input(INPUT_POST'mesg' FILTER_SANITIZE_STRINGFILTER_FLAG_NO_ENCODE_QUOTES); 
__________________
Brian's Web Design - Temecula

Last edited by skunkbad; 23-04-2008 at 06:35 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!RSS Share on Facebook Share This Article & VoteForum Netvibes Page
Reply With Quote
Reply


Thread Tools
Display Modes

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Giving some life to photos by adding titles axecity Graphic Design Techniques 2 24-04-2008 05:34 AM
adding a search box philjohns CSS Forum 8 23-04-2008 04:42 PM
NEW BLOG COMMUNITIES to Promote Your Design Blog Topic Graphic Design Blog Graphic Design Blog 0 14-02-2008 07:04 AM
Blue Web 2.0 Free Wordpress Blog Theme Graphic Design Links Graphic Design Links 0 18-01-2008 03:50 PM
Ever1 knows that I can't code. whitey-wonder Graphic Design and Web Design Help 9 21-03-2007 10:18 PM


All times are GMT. The time now is 06:55 AM.



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC5