Jump to content

HELP HELP : Change Select Box to Input BOX


ramesh_

Recommended Posts

I am using joomla modules which shows dropdown linst/select box for weblinks. All Weblink's title are shown on select box/drop down option.

 

BUT

 

I would like to change select box/ drop down box to Input Box, Where i can enter title instead selecting option from drop down.


<?php
 defined('_JEXEC') or die ('Direct Access is not allowed');
 $allweblinks = intval($params->get('allweblinks',0));
 $golabel = $params->get('buttonname','Go');
 $blank = intval($params->get('firstblank',0));
 $custom = $params->get('firsttext','');
 $separator = $params->get('separator','');
 $image = $params->get('buttonimage','-1');
 $catname = strtolower($params->get('catname','jumplinks'));
 $autodirect = intval($params->get('autodirect',0));
 if (isset($_POST['submit']) || isset($_POST['submit_x']))
 {
 	$link = $_POST['add'];
 	$target = $params->get('target','parent');
 	switch ($target)
 	{
  
 	case 'parent':
 		echo "<meta http-equiv='Refresh' content='0;URL=" .$link. "' />";
 		break;
 	case 'newwith':
 		echo "<meta http-equiv='Refresh' content='0;URL=" .$_SERVER["PHP_SELF"]. "' />";
 		echo "<script type='text/javascript'>window.open('".$link."');</script>";
 		break;
 	case 'newwithout':
 		echo "<meta http-equiv='Refresh' content='0;URL=" .$_SERVER["PHP_SELF"]. "' />";
 		echo "<script type='text/javascript'>window.open('".$link."','',config='toolbar=no');</script>";
 		break;
  
  
 	}
 	exit();
 }
 
 	$db = JFactory::getDBO();
 	$cat = "lower(jc.title) = '".$catname."' AND ";
 	if ($allweblinks == '1')
 		$cat = '';
 	$order = $params->get('order',0);
  
 	switch ($order)
 	{
 		case 0:
 			$orderStr = "ordering";
 			break;
 		case 1:
 			$orderStr = "j.title ASC";
 			break;
 		case 2:
 			$orderStr = "j.title DESC";
 	}
 	$query = "SELECT j.* FROM #__weblinks j inner join #__categories jc on j.catid = jc.id where $cat  j.published='1' AND jc.published='1' ORDER BY $orderStr";
 	$db->setquery($query);
 	$rows=$db->loadObjectList();
 	error_reporting(E_ERROR); 
 	$url = $_SERVER['SERVER_URI'];
 
 	echo "<form action='" . $url . "' method='post' >";
  

 		echo "<select style='display:none'  name='add' id='add'";
 		if ($autodirect == 1) 
 			{
 				 echo " onChange='this.form.elements";
 				 echo "[\"submit\"].click();' />";
 			}
 		else
 		{
 			echo " />";
 		}	 
 	if ($blank == '1')
 		echo "<option value='' />";
 	if ($custom != '')
 	{
 		echo "<option value='' />".$custom;
 		if ($separator != '')
 			echo "<option value='' />".str_repeat($separator,strlen($custom));
 	}

 	foreach ($rows as $row)
 	{
 		echo "<option value='" .$row->url. "' /> ". $row->title;
 	}
 	echo "</select>";
    
 		if ($autodirect == 1)
 		{
 			$style="style='visibility:hidden'";
 		}
 		if ($image !=-1 )
 		{
 			if ($autodirect ==1)
 				echo "<input type='submit' ".$style." id='submit' name='submit' value='".$golabel."' />";
 			$image = 'images/stories/'.$image;
 			echo "<input type='image' " .$style." src='".$image."' id='submit' name='submit' alt='".$golabel."' />";
 		}
 		else
 		{
 		 
 			echo "<input type='submit' ".$style." id='submit' name='submit' value='".$golabel."' />";
 		}


 	echo  "</form>";
 
 ?>



 

 

PHP file also attached.

ANY HELP  WILL BE HIGHLY APPRICIATED

Ramesh Chaudhary

Nepal

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.