update set_value for name and slug

Updated set_value('name', $name) and set_value('slug', $slug) 
to set_value('name', $sample->name) and set_value('slug', $sample->slug).

Otherwise the variables give a PHP error.