Jump to content

narjis

Members
  • Posts

    107
  • Joined

  • Last visited

Posts posted by narjis

  1. i am trying to show images on my show a images of my products and checking the image files using file_exists function although my images are present in the correct path, images are not showing instead no image found is being displayed.

    Here in my code:

     

    foreach($products as $pros){
         if(!file_exists(site_url()."theme/default/images/". $pros['image']))
                      $img = site_url()."theme/default/images/noimage.jpg";
              else $img = site_url()."theme/default/images/". $pros['image'];
            ?>
            <li>
                <div class="prodImage">
                <a href="<?=site_url()?>/marketplace/products/<?= $pros['id']?>">
                    <img src="<?=$img?>"  alt='No image' />
                </a>
                </div>
            <div class="ptitle"><?=$pros['name']?></div>
            <?php
            echo "<div class=\"description\">".$pros['description']."</div>";
            $attribs = array('id'=>'css_id',
                            'class' =>'viewLink');
            echo "<div class=\"view\">".anchor('marketplace/products/'.$pros['id'],'View',$attribs)."</div>"; ?>
                <div class="clear"></div>
            </li>
        <?php
        }?>
    </ul>
     

     

  2. i am trying to link a url to one of my controller from the top menu but each time it is appending the controller in the url.

    here is the code of my header.php

    <nav class="main-navigation clearfix span12" role="navigation">
     <h3 class="assistive-text">Main menu</h3>
     <ul>
      <li class="current"><a href="index.html">Home</a></li>
      <li>
       <a href="blog/about">About</a>
       <ul class="sub-menu">
     <li><a href="#">Subpage</a></li>
     <li><a href="#">Subpage 2</a></li>
       </ul>
      </li>
      <li><a href="contact.html">Contact</a></li>
     </ul>
    </nav>
    

     

    on clickng the About link the url keeps on extendig blog/blog/blog....../about.

     

    How to resolve this issue.

  3. what is the best architecture for developing a web application like this one:http://www.complinet.com/recruitment/

    I need some guidence in forming directory structure and building a proper web app without using any framework, if somebody can recommentd some book I'll be thankful.

    Thanks in advance

  4. I've been trying to edit my enum values in the database while retrieving them at the same time and if required editing them.How can i do that we'll I've tried the following code.

    The form which is inserting the values is as follows

    <?php
    mysql_connect("localhost","root","");
    mysql_select_db("Test");
    
    if(isset($_POST['status'])){
    $val=$_POST['status'];
    $sql = "INSERT INTO test_tb (my_opt) VALUES ('".$val."')";
    echo ($sql);
    if (mysql_query($sql)){
    	echo "Inserted";
    }
    }
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form method="post" action="">
    <select name="status" class="chzn_status" style="width:250px">
        <option value="0">Seelect Procress</option>
                            	<option value="In Process">In Procress</option>
                                <option value="Completed">Completed</option>
                                <option value="Deadline Crossed">Deadline Crossed</option>                                                    
                            </select>
                            <br />
                            If u want to view or edit ur insersions <a href='enumEg2.php'>click </a>here
                   <input type="submit" value="submit" />         
                </form>
    </body>
    </html>
    

    and the one which is editing and updating is as follows.

    <?php
    mysql_connect("localhost","root","");
    mysql_select_db("Test");
    
    $arr = array("In Process", "Completed","Deadline Crossed");
    
    $sql = "SELECT * FROM test_tb ";
        $table="<table border='0' >";
      
    $res = mysql_query($sql);
    while($rows = mysql_fetch_assoc($res))
    {		
    $table .= "<tr><td>".$rows['id']."</td>";
    $table .= "<td>";
    $table .= "<form method='post' action=''><select name=\"status\">
    			<option value=".$rows['my_opt'].">". $rows['my_opt'] ."</option>";
    			foreach($arr as $key=>$val){
    			$table .= "<option value=$key>$val</option>";
    			$table .= ($val==$rows['my_opt'])?$rows['my_opt']:'';
    			}
    			$table .= "</form>";
    
    
    $table .=" </select><td><a href='enumEg2.php?opt_id=".$rows['id']."&opt=".$_REQUEST['name']."'>Change";
    $table .="</td></tr>";
    }
    $table .="</table>";
    
    ?>
    <?php if(isset($_GET['id'])){
    $id = $_GET['id'];
    $opt_val = $_GET['opt'];
    $sql = "UPDATE test_tb SET my_opt='".$opt_val."'";
    mysql_query($sql);
    }
    
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <?php echo $table;?>
    </body>
    </html>
    

     

     

    Pls  somebody help me.

  5. I have a table having enum values and now i'm trying to insert and update the values according to the select values. It is not updating . Is is possible to update the values according to the form selection. Here is my code:

    
    <select name="task_type"  id="task_type" class="chzn-select" style="width:250px">
                                <option value="0">Select Task Type</option>                       
                                <option value="1">Controlled</option>
                                <option value="2">Simple</option>
                                <option value="3">With Notification</option>
                                <option value="4">Collabration</option>         
                                <option value="5">Periodically</option>         
                                <option value="6">Once</option>         
                                <option value="7">Note</option>                                              
                            </select>
    

     

     

    and Here is the way I'm updating in the database;

    
    
    		$table = user_tasks;
    		$data = array(
    			'portal_id' => $portal_id,
    			'company_id' => $company_id,
    			'user_id' => $user_id,
    			'parent_id' => intval($_POST['parent_id']),
    			'assigned_to' => sanitize($_POST['assigned_to']),
    			'title' => sanitize($_POST['title']), 
    			'task_type' => sanitize($_POST['task_type']),
    			'description' => sanitize($_POST['description']),				
    			'status' => sanitize($_POST['status']),
    			'file_name'=> sanitize($_FILES['file_name']['name']),
    			'task_end_date' => sanitize($_POST['timetask']),
    			'repeat' => sanitize($_POST['repitition']),
    			'date_updated' => date('Y-m-d H:i:s')
    		);
    
    ($this->id) ? $db->update($table, $data, "id='" . (int)$this->id . "'") : $db->insert($table, $data);
    		$message = ($this->id) ? "Task Updated Successfully" : "Task Added Successfully";
    

     

     

  6. I'm trying to update a  table having three primary keys but getting the following error:

    Duplicate entry '1-1' for key 'PRIMARY' when updating the database.

    Before it was updating properly when I had made only one primary key.

  7. I'm using JQuery datepicker and it is succesully returning  but I'm also using tinyMCE in the same form when the calender appears tinyMCe is disappearing.

    Here is my code

    <script type="text/javascript">
        $(function() { // Shorthand for $(document).ready(function() {
              $('select').change(function() {
                    $.post('option.php', {data: $(this).val()}, function(data) {
                          $('div').addClass('datepicker').html(data);
                         // $( "#datepicker" ).datepicker();
                         // $( "#datepicker" ).datepicker.formatDate({dateFormat: 'yy-mm-dd'});
                        //  $( "#taskTime").val() =
                         $('#datepicker').datepicker({
            dateFormat: 'yy-mm-dd',
            inline: true,
            //minDate: new Date(2010, 1 - 1, 1),
            //maxDate:new Date(2010, 12 - 1, 31),
            altField: '#datepicker_value',
            onSelect: function(){
                var day1 = $("#datepicker").datepicker('getDate').getDate();                
                var month1 = $("#datepicker").datepicker('getDate').getMonth() + 1;            
                var year1 = $("#datepicker").datepicker('getDate').getFullYear();
                var fullDate = year1 + "-" + month1 + "-" + day1;
                $('input[name=taskTime]').val(fullDate);
               
            }
        });
                    });
               
    
              });
             /* $(function() {
            $( "#datepicker" ).datepicker();
        });*/
        });
       
        tinyMCE.init({
            // General options
            mode : "textareas",
            theme : "advanced",
            plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
    
            // Theme options
            theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
            theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
            //theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
            //theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_statusbar_location : "bottom",
            theme_advanced_resizing : true,
    
            // Example content CSS (should be your site CSS)
            //content_css : "css/content.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",
    
            // Style formats
            style_formats : [
                {title : 'Bold text', inline : 'b'},
                {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
                {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
                {title : 'Example 1', inline : 'span', classes : 'example1'},
                {title : 'Example 2', inline : 'span', classes : 'example2'},
                {title : 'Table styles'},
                {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
            ],
    
            // Replace values for the template plugin
            template_replace_values : {
                username : "Some User",
                staffid : "991234"
            }
        });
    </script>
    <!-- /TinyMCE -->
    

    Here is my form

     

     <form method="post" id="frm" enctype="multipart/form-data" encoding="multipart/form-data">
       Subject:<input type='text' name='subject' /><br />
       Assigned To:<input type='text' name='assigned' /><br />
       Task:<select id="opt" name="taskOpt">
        <option value="0" selected>Select Task</option>
        <option value="1">Controlled</option>
        <option value="2">With Notification</option>
        <option value="3">Periodically</option>
        <option value="4">Simple</option>
    
        </select>
        <input type="hidden" name="taskTime" id="taskTime"/>
    <!--
      <div>
      </div>--><br /><br />
           <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
           
                <textarea name="task" id="elm1" name="elm1" rows="15" cols="100" style="width: 100%">
                   
                </textarea>
       
       
            <br />
            <input type="submit" name="save" value="Submit" />
            <input type="reset" name="reset" value="Reset" />
    </form>
    

     

    On selecting the first and second option calender input is showing datepicker. Here is the php code

        <?php
        $val=$_POST['data'];
        switch($val){
        case 0:
            echo "Please select a task";
            break;
        case 1:
            echo "complete till:<input name='timetask' id='datepicker' type='text' />";
            break;
        case 2:
            echo "complete till:<input name='timetask' id='datepicker' type='text' />";
            break;
           
        default:
            //echo $val;
            break;
            }
    
    

    textare is disappearing and showing extra tags

  8. i've changed it to

    $('#cal').click(function(){

    alert('hello');

    });

    but it is still not working. Actually the load event is not triggering

     

    $('.datepicker').load(function(){
    			/*$('.datepicker').datepicker({
    				inline: true
    			});*/
    			//alert('hello');
    			$('#cal').click(function(){
    			alert('hello');
    			});
    		});
    });

    what shall I do.

  9. Hi, I'm loading the div successfully but it is not showing the alert message on load. I want to set click event on the input field which is inside this div. Please somebody help me. :'( .

    Here's my code.

     

       <form method="post" id="frm">
      <select id="opt">
      <option value="1">Controlled</option>
      <option value="2">With Notification</option>
      <option value="3">Periodically</option>
      <option value="4">Simple</option>
      
      </select>
      </form>
      <div>
      </div>
      <script src="js/jquery.ui.core.js"></script>
    <script src="js/jquery.ui.widget.js"></script>
    <script src="js/jquery.ui.datepicker.js"></script>
        <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.23.custom.min.js"></script>
      <script> 
    
    
        $("select").change(function () {
              var str = "";
              $("select option:selected").each(function () {
                    str += $(this).val() ;
                  });
              $.post("option.php",{data:str},
    	  function(data){
    	  $("div").addClass('datepicker').html(data);
    	  //alert(data);
    	}
    	);
    
            });
        
    $('div.datepicker').load(function(){
    			$('.cal').click(function(){
    			alert('hello');
    });
    
    		});
    </script>
    

     

    and here is my php code which is responding

    <?php
    $val=$_POST['data'];
    switch($val){
    case 1:
        echo "<input id='cal' type='text' value='$val'/>";
    break;
    case 2:
        echo "<input id='cal' type='text' value='$val'/>";
    break;
    
    default:
    echo $val;
    break;
    }
    

     

  10. Hi, I'm unable to focus on an input field inside a div. here is my code.

    <script> 
    
    
        $("select").change(function () {
              var str = "";
              $("select option:selected").each(function () {
                    str += $(this).val() ;
                  });
              $.post("option.php",{data:str},
    	  function(data){
    	  $("div").addClass('datepicker').html(data);
    	  //alert(data);
    	}
    	);
            });
         //  .trigger('change');
    // Datepicker
    $('.datepicker').load(function(){
    			alert('hello');
    });
    </script>

  11. The expression is working fine but when I'm giving $number='0-12-345-69'

    it is giving Exception

    Here is the whole code.

    function ReformatPhoneNumber($number){
    $len = strlen($number);
    $RegExp = '/^\\d+(?:-\\d+)?\\z/';
    $newNum='';
    
    try{
    if (($len <7)||($len>12)){
      throw new Exception("Number of invlaid length\n");
    }
        if(!preg_match($RegExp,$number))
         throw new Exception("Only numbers are allowed\n");
    
    echo preg_replace('/-/','',$number);
    
    }
    catch(Exception $e){
      echo ($e->getMessage()); 
    }
    
    
    
    }
    $num = ReformatPhoneNumber('0-12-3-69');
    echo $num;
    

  12. I have to pass a string inthe function which matches only numbers and if one '- ' comes it is a valid string but more than one hyphen together gives exception. Output should be a series of number.

    E.g.

    Calling the function with any of these values: '012345', '-012345 678', '01203- 34566', '1234x567' should result in an exception

    Here is my code but it is not working for the cases

    function ReformatPhoneNumber($number){
    
    try{
        if(!preg_match('/[0-9]*(-)*$/',$number))
         throw new Exception("Only numbers are allowed\n");
    //return false;
    //else{
    return preg_replace('/(-)*/','',$number);
    //echo $number;//}
    }
    catch(Exception $e){
      echo ($e->getMessage()); 
    }
    
    
    
    }
    $num = ReformatPhoneNumber('0-12-345n69');
    echo $num;

  13. I'm trying to send input data to some php file but it is not showing correct results.

    here is my jquery script.

    $(document).ready(function(){
    $('#existing_txt').load('ajaxLoad.php');
    $("#frm").submit(function(){
    	$.post('ajaxChat.php',$('#frm').serialize(),
    	function(data) {
    	alert(data);
    //$('#existing_txt').html(data);
    					});
    });
    });
    

    jaxLoad.php is workig fine but data is not being posted to ajaxChat.php wher i'm gim(#frm).submit();

     

    Here is my html

    <div id="existing_txt"> </div>
    <form id="frm">
    
    Enter the text to be saved as chat<input type="text" name="chatText" /><br />
    <input type="submit" value="Save Text" />
    </form>

×
×
  • 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.