Buying Add sub dropdown onclick, and set selected. $50

Discussion in 'Programming' started by basketmen, Oct 27, 2011.

  1. #1
    I have a profile file, below are the content



    <?php
    class user_system_specs extends z_module
    {
        function contents()
        {
    		$content = $this->content;
    		$html .= '<div class="' . $this->style['pmain2'] . '"><a href="' . $this->_zoints->url('blocks', 'cmd=editmod&amp;modid=' . $this->linkid) . '">' . ($this->powner ? __('<b>Add/Edit</b>') : __('')) . '</a></div>';
    		$html .= ($content[country] ? '<div class="' . $this->switch_bg() . '"><strong>Country:</strong> ' . @htmlspecialchars($content[country]) . '</div>' : '');
    		$html .= ($content[university] ? '<div class="' . $this->switch_bg() . '"><strong>University:</strong> ' . @htmlspecialchars($content[university]) . '</div>' : '');
    				
    		return $html;
        }
        
        function edit()
        {
    		$content = $this->content;
    		$html .= '<div class="pmain1">';
    		
    		$html .= 'Country:<br /> 
    					<fieldset>
    <legend>Country Name</legend>
    <div>
    <select class="input" name="mod[content][country]">
    <option value=""> </option>
    <option value="Argentina">Argentina</option>
    <option value="Brazil">Brazil</option>
    <option value="United Kingdom">United Kingdom/option>
    <option value="United States">United States</option>
    </select>
    </div>
    </fieldset><br />';
    		
    		$html .= 'University:<br /> 
    					<fieldset>
    <legend>University Name</legend>
    <div>
    <select class="input" name="mod[content][university]">
    <option value=""> </option>
    <option value="Cambridge">Cambridge</option>
    <option value="Harvard">Harvard</option>
    <option value="MIT">MIT</option>
    <option value="Princeton">Princeton</option>
    </select>
    </div>
    </fieldset><br />';
    		
    		
    		$html .= '</div>';
    		return $html;
        }
        
        function update($content)
        {
            return $content;
        }
    } 
    ?>
    PHP:





    Here are the edit page screenshot normally, user choosing they Country and University

    [​IMG]



    the output screenshot normally, after user choosed the drop down, are like this

    [​IMG]










    Now, i want more specific
    Not only Country, but States too
    and Not only University, but the Faculty too

    i can put all of them in a page, but it will make the page are very heavy, there should be thousands drop down lines for States and Faculty list



    so maybe the solution is using sub dropdown onclick

    when choosing Country, it will opening all States from that country, and when choosing University, it will opening all Faculty from that university, for example like this

    [​IMG]



    the output example

    [​IMG]




    maybe you can use ajax or other thing, so user no need to load states and faculty that they dont need, so very less size page











    Nb.
    - The choosen line are saved in mysql, but for the list we can put it just in a file, like file above, or in few files
    - You must set selected too after that, so when user edit the profile again, the drop down are selected with the line that they choosed
    - $50 if you can do this, if needed i will give you ftp details
     
    Last edited: Oct 27, 2011
    basketmen, Oct 27, 2011 IP
  2. basketmen

    basketmen Well-Known Member

    Messages:
    837
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    130
    As Seller:
    100% - 0
    As Buyer:
    100% - 4
    #2
    a member is doing it now, other member still can pm me if he cant do it
     
    basketmen, Oct 27, 2011 IP
  3. zappak

    zappak Active Member

    Messages:
    366
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    80
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    sent you p-m.. waiting for reply :)
     
    zappak, Oct 28, 2011 IP
  4. ryandanielt

    ryandanielt Well-Known Member

    Messages:
    1,797
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    185
    As Seller:
    100% - 2
    As Buyer:
    100% - 0
    #4
    Why wouldn't you just lighten up your code and pull the results from a database. When using javascript the way you are it will turn into a very large file and unless you compress it then it will hurt your seo ratings. Pulling from the database may also be much quicker because it would use straight PHP rather then having to load hundreds of lines of javascript.
     
    ryandanielt, Oct 28, 2011 IP