Dynamically Dropdown Value On Code Igniter

Code Igniter November 24th, 2008

Yeah, Code Igniter again. I this day i got problem with dynamically dropdown value on Code Igniter. First think i hope I can generate dropdown with values from mySql database. I want to use form helper that provided by Code Igniter to generate form.

Basically to make dropdown input on controller are:

1
2
3
4
5
6
...
$data['input_category'] = array(
	"1" => "Mobile",
        "2" => "Web"
); 
...

Then in views:

1
2
3
...
<?php echo form_dropdown('category',$input_category);?>
...

Prety simple right??
but now.. How to make it values generate dynamically??
Read the rest of this entry »

Sphere: Related Content

Tags: ,
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Using Gravatar Without Plugin by Connor Wilson

Wordpress November 6th, 2008

Connor Wilson has published nice post. He wrote about how to make gravatar without plugin and I’ll share for you. First, add this script to your comments page.

1
2
3
4
5
6
7
<?
$email = ""; //email that user use in gravatar
$default = ""; // link to your default avatar or if user doesn't have gravatar
$size = 40; // size in pixels squared
$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=
  ". md5($email) . "&default=" . urlencode($default) . "&size=" . $size;
?>

Then call it gravatar on tag <img src”"> like this:

1
<img src="<?=$grav_url ?>" height="<?=$size ?>" width="<?=$size ?>" alt="User Gravatar" />

Put it on each comments. That’s all.. Easy right.. hehe.

Thx Connor. I’ll use it on my current project with Code Igniter.

Sphere: Related Content

Tags: , ,
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Multiple Submit Button On HTML Form

Whatever November 3rd, 2008

Identifying the submit button in the server side
The name and value of the button that is used to submit the form is passed along with the other data to the server script. For the button above, when you click on the submit button, the data passed to the server side script is mysubmit=Click!
Having Multiple Submit buttons
You can have more than one submit button in a form. But, how to identify from the server side which button submitted the form?

One way is to have different names for the submit buttons.

1
2
<INPUT type="submit" name="Insert" value="Insert">
<INPUT type="submit" name="Update" value="Update">

Read the rest of this entry »

Sphere: Related Content

Tags: ,
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Get Next Auto Increment on Code Igniter

Code Igniter October 30th, 2008

Today, I got problems to get next auto increment with Code Igniter. In this case, I tried to provide link to view current post page, after users post his blog. For example: blog table contain fields id, title, and body. I used auto increment for id and id as primary key. Users will only fill title and body on form available, and id will automatically auto increment on MySql Table. So I can’t send id by post method.

Well in this case, I need to get next auto increment to detect id on current user post. Why? because I usually sent post id parameters on url. For example: http://localhost/blog/fullpage/45 with base http://localhost/. So, post id placed on segment(2) of uri. Then I make query from table blog where id = uri segment(2) to get fullpage post where id = 45.

Read the rest of this entry »

Sphere: Related Content

Tags: , , ,
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Error Number 0×800ccc19 Caused By Antivirus Program

Problem October 25th, 2008

Today I tried to connect to my mail server on my office with outlook. But I always got connection timeout to mail server message and showing error number 0×800ccc19. I had checked my account setting to make sure that’s correct setting, but I got connection time out again. I tried to use my account setting in another computer and it’s working. Wew, so what happen with my computer?

Read the rest of this entry »

Sphere: Related Content

Tags: , ,
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Blogroll Link Update