• wayward2012

    (@wayward2012)


    Hi

    I want create in this form, a combobox.

    The categorie will have the categories, and change the Localitation field for another select menu and include that a subcategories of the main categories.

    Ex: Countries—–>Citys

    The value of both comobox will be the same of the label.
    thanks

    <blockquote>

    <?php
    /*
    Template Name: Create a Job
    */
    ?>
    <?php
    session_start();
    ob_start();
    set_time_limit(0);
    if($_REQUEST[‘backedit’]==”)
    {
    $_SESSION[‘ads_information_session’] = array();
    }
    if(!$current_user->data->ID)
    {
    wp_redirect(get_settings(‘home’).’/index.php?page=login’);
    exit;
    }
    global $wpdb,$General;
    $generalinfo = $General->get_general_settings();

    $pid = $_REQUEST[‘pid’];
    $data = array();
    if($_SESSION[‘ads_information_session’][‘post’])
    {
    $post_info = $_SESSION[‘ads_information_session’][‘post’];
    $data[‘post_title’] = $post_info[‘post_title’];
    $data[‘description’] = $post_info[‘description’];
    $data[‘post_location’] = $post_info[‘post_location’];
    $data[‘geo_latitude’] = $post_info[‘geo_latitude’];
    $data[‘geo_longitude’] = $post_info[‘geo_longitude’];

    $data[‘post_url’] = $post_info[‘post_url’];
    $data[‘owner_name’] = $post_info[‘owner_name’];
    $data[‘owner_email’] = $post_info[‘owner_email’];
    $data[‘owner_phone’] = $post_info[‘owner_phone’];
    $data[‘termid’] = $post_info[‘termid’];
    $data[‘post_tags’] = $post_info[‘post_tags’];
    $data[‘coupon_code’] = $post_info[‘coupon_code’];
    $data[‘feature_prd’] = $post_info[‘feature_prd’];
    if($_SESSION[‘ads_information_session’][‘images’])
    {
    $post_images = implode(‘,’,$_SESSION[‘ads_information_session’][‘images’]);
    }
    }
    elseif($pid)
    {
    $post_info = $General->get_post_info($pid);
    $data[‘post_title’] = $post_info[‘post_title’];
    $data[‘description’] = $post_info[‘post_content’];
    $catinfoarr = get_the_category($post_info[‘ID’]);
    $isfeature = ”;
    for($c=0;$c<count($catinfoarr);$c++)
    {
    if($catinfoarr[$c]->term_id == $generalinfo[‘feature_catid’])
    {
    $isfeature = ‘checked=”checked”‘;
    }else
    {
    $data[‘termid’] = $catinfoarr[$c]->term_id;
    }
    }
    $data[‘post_location’] = get_post_meta($post_info[‘ID’], ‘post_location’, $single = true);
    $data[‘geo_latitude’] = get_post_meta($post_info[‘ID’], ‘geo_latitude’, $single = true);
    $data[‘geo_longitude’] = get_post_meta($post_info[‘ID’], ‘geo_longitude’, $single = true);
    $data[‘post_url’] = get_post_meta($post_info[‘ID’], ‘post_url’, $single = true);
    $data[‘owner_name’] = get_post_meta($post_info[‘ID’], ‘owner_name’, $single = true);
    $data[‘owner_email’] = get_post_meta($post_info[‘ID’], ‘owner_email’, $single = true);
    $data[‘owner_phone’] = get_post_meta($post_info[‘ID’], ‘owner_phone’, $single = true);
    $post_images = get_post_meta($post_info[‘ID’], ‘post_images’, $single = true);
    $tagsarr = get_the_tags($post_info[‘ID’]);
    if($tagsarr)
    {
    $tags = array();
    foreach($tagsarr as $key=>$val)
    {
    $tags[] = $val->name;
    }
    $post_tags = implode(‘,’,$tags);
    $data[‘post_tags’] = $post_tags;
    }
    }
    //echo “

    ";
    //print_r($_SESSION['ads_information_session']);
    ?>
    
    <?php get_header(); ?>
    
    <div id="page">
    <div id="content-wrap" class="clearfix" >
    
    <div id="content" class="content-in-detail_form">
    <h1><?php _e(POST_CLASSIFIED_PAGE_TITLE);?> </h1>
    
    <div class="clearfix" ><p class="alignright ">
    <span class="indicates">*</span>
    Indicates mandatory fields </p>
    </div>
    
    <form name="createjob_frm" id="createjob_frm" action="<?php echo get_option('siteurl');?>/?page=adsview" method="post" enctype="multipart/form-data">
    <input type="hidden" name="pid" value="<?php echo $pid;?>" />
    
         <div class="create_post_row clearfix"> <label><?php _e(SELECT_CAT_TEXT);?> : <span class="indicates">*</span> </label>
    
         <select name="termid"  id="termid" class="select">
         <option value=""><?php _e(SELECT_CAT_DL_TEXT);?></option>
         <?php
        	$blogcatids = $General->get_blog_catid();
    		$excludecat = '1, 96, 98,'.$General->get_feature_catid();
    		if($blogcatids)
    		{
    			$excludecat .= ','.$blogcatids;
    		}
    
    		echo  $General->get_category_dropdown_options($data['termid'],$excludecat);
    	 ?>
         </select>
          <span id="termidInfo"></span>
          </div>  
    
         <div class="create_post_row clearfix"> <label> <?php _e(ADS_TITLE_TEXT);?> : <span class="indicates">*</span> </label>
        <input name="post_title" id="post_title" value="<?php echo $data['post_title'];?>" type="text" class="textfield required email" />
        <span id="post_titleInfo"></span>
         </div>
    
        <div class="create_post_row clearfix"> <label> <?php _e(LOCATION_TEXT);?> : <span class="indicates">*</span>  </label>
        <input name="post_location" id="post_location" value="<?php echo $data['post_location'];?>" type="text" class="textfield"  />
        <span id="post_locationInfo"></span>
         </div>
          <div class="create_post_row clearfix" style="display:none">
    		 <?php require_once (TEMPLATEPATH . '/library/map/location_add_map.php');?>
             </div>
           <div class="create_post_row clearfix" style="display:none">
            <label><?php echo EVENT_ADDRESS_LAT;?> </label>
            <input type="text" name="geo_latitude" id="geo_latitude" class="textfield" value="<?php echo $data['geo_latitude'];?>" size="25"  />
            <span class="note"><?php echo GET_LATITUDE_MSG;?></span>
         </div>
         <div class="create_post_row clearfix" style="display:none">
            <label><?php echo EVENT_ADDRESS_LNG;?> </label>
            <input type="text" name="geo_longitude" id="geo_longitude" class="textfield" value="<?php echo $data['geo_longitude'];?>" size="25"  />
           <span class="note"><?php echo GET_LOGNGITUDE_MSG;?></span>
         </div>
    
        <div class="create_post_row"> <label> <?php _e(DESCRIPTION_TEXT);?> : <!--<span class="indicates">*</span>-->  </label>
         <textarea cols="" rows="4" class="textarea" name="description" id="description"  ><?php echo $data['description'];?></textarea>
         <span id="descriptionInfo"></span>
         <input type="hidden" name="description_max_len" id="description_max_len" value="<?php echo $generalinfo['max_ads_char'];?>" />
        <?php
        if($generalinfo['max_ads_char'])
    	{
    	?>
    
            <span class="note"> <?php _e(MAX_CHARS_MSG);?> <?php echo $generalinfo['max_ads_char'];?>  <?php _e('chars');?>.</span>
         <?php
         }
    	 ?>
          </div>
         <?php
         global $user_identity;
    	get_currentuserinfo();
    	 ?>
        <div class="create_post_row clearfix" >  <label> <?php _e(OWNER_NAME_TEXT);?> : <span class="indicates">*</span></label>
         <?php
         if($data['owner_name'])
    	 {
    	 	$owner_name = $data['owner_name'];
    	 }else
    	 {
    	 	$owner_name = $current_user->data->display_name ;
    	 }
    	 if($data['owner_email'])
    	 {
    	 	$owner_email = $data['owner_email'];
    	 }else
    	 {
    	 	$owner_email = $current_user->data->user_email ;
    	 }
    	 $userinfoarr = unserialize($current_user->data->user_address_info);
    	 if($data['owner_phone'])
    	 {
    	 	$owner_phone = $data['owner_phone'];
    	 }else
    	 {
    	 	$owner_phone = $userinfoarr['user_phone'] ;
    	 }
    	 if($data['post_url'])
    	 {
    	 	$post_url = $data['post_url'];
    	 }else
    	 {
    	 	$post_url = $current_user->data->user_url ;
    	 }
    
    	 ?>
         <input name="owner_name" id="owner_name" value="<?php echo $owner_name;?>" type="text" class="textfield"  />
         <span id="owner_nameInfo"></span>
          </div>
    
        <div class="create_post_row clearfix">  <label><?php _e(INQUIRY_EMAIL_TEXT);?> : <span class="indicates">*</span> </label>
          <input name="owner_email" id="owner_email" value="<?php echo $owner_email;?>" type="text" class="textfield"  /> <span class="note"><?php _e(INQUIRY_EMAIL_TEXT_NOTE);?> </span>
          <span id="owner_emailInfo"></span>
           </div>
    
        <div class="create_post_row clearfix" style="display:none"> <label><?php _e(PHONE_TEXT);?> : </label>
        <input name="owner_phone" id="owner_phone" value="<?php echo $owner_phone;?>" type="text" class="textfield" /> </div>
    
         <div class="create_post_row clearfix" style="display:none"> <label> <?php _e(TAGS_TEXT);?> : </label>
          <input name="post_tags" id="post_tags" value="<?php echo $data['post_tags'];?>" type="text" class="textfield" /> </div>
    
         <div class="create_post_row clearfix" style="display:none"> <label> <?php _e(URL_TEXT);?> :  </label>
        <input name="post_url" value="<?php echo $post_url;?>" type="text" class="textfield" />
        <span class="note"> <?php _e(URL_TEXT_NOTE);?> </span>
       </div> 
    
        <div class="create_post_row clearfix"> <label> <?php _e(UPLOAD_IMAGES_TEXT);?> </label>
    
         <?php /*?><input name="images[]" value="" type="file" class="jobtextfield" /><?php */?>
    
        <div class="upload">
        <input name="fileId" id="fileId" value="" type="hidden">
        <input name="fileTitle" id="fileTitle" value="" type="hidden">
        <input value="1" name="Count" id="Count" type="hidden">
        <input name="images[]" value="" type="file" class="textfield" />
       	 <div id="file_div"> </div>
       <input type="button" name="AddNew" value="Add New" class=" addnew" onClick="customClick('file','','','');" />
     	</div>
    
       <div style="clear:both;">
         <?php
         if($post_images!='')
    	 {
    	 	$post_images_arr = explode(',',$post_images);
    		for($i=0;$i<count($post_images_arr);$i++)
    		{
    			?>
    
               <div style="width:50px;   float:left; margin:0 11px 11px 0; " id="img_<?php echo $i;?>" >
               <img src="<?php bloginfo('template_directory'); ?>/thumb.php?src=<?php echo $post_images_arr[$i]; ?>&w=50&h=50&zc=1<?php echo $thumb_url;?>" alt="<?php the_title(); ?>"   />
               <input type="hidden" name="hidden_image[]" value="<?php echo $post_images_arr[$i]; ?>" />
               ','img_<?php echo $i;?>');"><?php _e(REMOVE_LINK_TEXT);?>
               </div>
    
                <?php
    		}
    	 }
    	 ?>
    		           </div>
          </div>
         <input type="hidden" name="type" value="<?php echo $_REQUEST['type'];?>" />
         <?php
        if($_REQUEST['pid'])
    	{
    		if($isfeature!='')
    		{
    	?>
        <input type="hidden" name="feature_prd" value="1" />
        <?php _e(POST_ADS_FEATURE_MSG1);?>
        <?php
    		}
    	}else
    	{
    	?>
        	<div class="create_post_row clearfix" style="display:none"> <label> <?php _e(COUPON_CODE_TEXT);?> :  </label>
            <input name="coupon_code" value="<?php echo $data['coupon_code'];?>" type="text" class="textfield" />
            <span class="note"> <?php _e(COUPON_CODE_TEXT_NOTE);?> </span>
           </div>
        <?php
    		 if($generalinfo['feature_catid'])
    		 {
    		?>
            <div class="create_post_row clearfix"> <span class="pay_basic"><?php _e(POST_ADS_FEATURE_MSG2);?>  <?php echo $generalinfo['currencysym'].$generalinfo['ads_price'];?>.</span></div>
    
    		<div class="create_post_row clearfix row_spacer">  <span class="featured_ads_price">  <input type="checkbox" <?php echo $isfeature;?> <?php if($data['feature_prd']){ echo 'checked="checked"';}?>  name="feature_prd" value="1" /> <?php _e(POST_ADS_FEATURE_MSG3);?>
    		<?php if($isfeature ==''){?>
    		<?php _e(POST_ADS_FEATURE_MSG4);?> <strong class="extra_price">  <?php echo $generalinfo['currencysym'].$generalinfo['feature_ads_price'];?>  <?php _e(POST_ADS_FEATURE_MSG5);?>
    		<?php }?>  </span>
    		</div>
    
    		<?php
    		 }
    	 }
    	 ?>
         <input type="submit" name="submit" value="<?php _e(PREVIEW_BUTTON);?>"  class="normal_button preview" />
    </form>
    <script>
    function removeImage(imagename,divid)
    {
    	document.getElementById(divid).innerHTML='';
    }
    </script>
    <script>
    var Row = 1;
    function customClick(customfield,nameval)
    {
    	Row++;
    
    	var email_div = customfield+'_div';
    	var emailDiv=document.getElementById(email_div);
    	var newDiv=document.createElement('div');
    	newDiv.setAttribute('id',email_div+Row);
    	newDiv.setAttribute('style','margin-top:5px');
    	var newTextBox=document.createElement('input');
    
    	newTextBox.type='file';
    	newTextBox.setAttribute('id',customfield+'_name'+Row);
    	newTextBox.setAttribute('name','images[]');
    	newTextBox.setAttribute('class','textbox');
    	newTextBox.setAttribute('size','15');
    	newTextBox.setAttribute('maxlength','50');
    	newTextBox.setAttribute('style','width:auto');
    	if(nameval){newTextBox.setAttribute('value',nameval);}else{newTextBox.setAttribute('value',customfield);}
    	newTextBox.setAttribute("onblur","if(this.value=='') this.value = '"+customfield+"';");
    	newTextBox.setAttribute("onfocus","if(this.value=='"+customfield+"') this.value= '';");
    
    	nameStr = document.getElementById(customfield+'Title').value;
    	valueStr = document.getElementById(customfield+'Id').value;
    
    	var newLink = document.createElement('a');
    	newLink.setAttribute('class','smallLink');
    	newLink.setAttribute('href','javascript:void(0)');
    	newLink.setAttribute('tabindex','2');
    
    	document.getElementById('Count').value = Row;
    
    	var linkText=document.createTextNode('Remove');
    	newLink.appendChild(linkText);
    	newLink.onclick=function RemoveEntry() { var imDiv=document.getElementById(email_div);
    
    	emailDiv.removeChild(this.parentNode);
    	}
    
    	newDiv.appendChild(newTextBox);
    	newDiv.appendChild(document.createTextNode('\u00A0\u00A0\u00A0\u00A0'));
    	newDiv.appendChild(newLink);
    	emailDiv.appendChild(newDiv);
    }
    </script>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/jquery.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/adv_validation.js"></script>
    </div><!--content end -->
    <!-- TinyMCE -->
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
    	tinyMCE.init({
    		// General options
    		mode : "textareas",
    		theme : "advanced",
    		plugins :"advimage,advlink,iespell,",
    
    		// Theme options
    		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,bullist,numlist,blockquote,|,link,unlink,anchor,image,code",
    		theme_advanced_buttons2 : "",
    		theme_advanced_buttons3 : "",
    		theme_advanced_buttons4 : "",
    		theme_advanced_toolbar_location : "top",
    		theme_advanced_toolbar_align : "left",
    		theme_advanced_statusbar_location : "bottom",
    		theme_advanced_resizing : true,
    
    		// Example word content CSS (should be your site CSS) this one removes paragraph margins
    		content_css : "css/word.css",
    
    		// Drop lists for link/image/media/template dialogs
    		template_external_list_url : "lists/template_list.js",
    		external_link_list_url : "lists/link_list.js",
    		external_image_list_url : "lists/image_list.js",
    		media_external_list_url : "lists/media_list.js",
    
    		// Replace values for the template plugin
    		template_replace_values : {
    			username : "Some User",
    			staffid : "991234"
    		}
    	});
    </script>
    <!-- /TinyMCE -->
    <?php include (TEMPLATEPATH . "/footer_index.php"); ?>`

  • The topic ‘Combobox’ is closed to new replies.