Results 1 to 6 of 6

Thread: Populate Database with custom field (Dropwdown)

  1. #1
    Thread Starter
    Rookie
    Not a Verified Customer
    tedece's Avatar
    Join Date
    Mar 2010
    Location
    Avignon
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Populate Database with custom field (Dropwdown)

    Hi everybody,

    I want to populate my database with a custom field, but i want to display a drop down list of them.

    This the code for a simple input text :
    Code:
    <label for="location"><?php _e('Ville','cp'); ?> <span>*</span></label>
    				<input type="text" id="location" class="adfields" name="location" size="60" maxlength="100" value="<?php echo stripslashes($_POST['location']); ?>" />
    And this my code for a drop down list :
    Code:
    <label for="region"><?php _e('>R&eacute;gion et D&eacute;partement','cp'); ?><span>*</span></label>
    						<select name='region' id='region'>
    	<option value='-1'>Votre choix</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Alsace</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Aquitaine</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Auvergne</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Basse Normandie</option>
    
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Bourgogne</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Bretagne</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Centre</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Champagne-Ardenne</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Corse</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Franche Comté</option>
    
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Haute Normandie</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">île de France</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Languedoc-Roussillon</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Limousin</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Lorraine</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Midi-Pyrénées</option>
    
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Nord-Pas-de-Calais</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Outre mer</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">PACA</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Pays de la Loire</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Picardie</option>
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Poitou-Charentes</option>
    
    	<option class="level-0" value="<?php echo stripslashes($_POST['region']); ?>">Rhônes-Alpes</option>
    </select>
    Of course the second piece of code doesn't work...
    I saw somewhere in the forum someone who explain how to do this but i can't find it anymore.

    Thanks for help

  2. #2
    pepsi's Avatar
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    14,883
    Thanks
    91
    Thanked 804 Times in 718 Posts

    Re: Populate Database with custom field (Dropwdown)

    Is this the thread you were thinking of? http://wpclassipress.com/forum/viewt...0&t=347&p=6285.

    Also another thread with link to creating custom fields http://wpclassipress.com/forum/viewt...hp?f=11&t=1752

  3. #3
    Thread Starter
    Rookie
    Not a Verified Customer
    tedece's Avatar
    Join Date
    Mar 2010
    Location
    Avignon
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Populate Database with custom field (Dropwdown)

    Thanks a lot Pepsi !

    I stayed a long on the first post..
    But i discover the second.

    On the second i found : "Classipress: Adding Custom Fields" i have asked how i can do with a dropdown list... so i wait.

    No the thread i thinking of is from : dcowgill
    I searched in his 26 pages of posts, but nothing...

  4. #4
    pepsi's Avatar
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    14,883
    Thanks
    91
    Thanked 804 Times in 718 Posts

    Re: Populate Database with custom field (Dropwdown)

    http://wpclassipress.com/forum/viewt...f=4&t=20&p=211

  5. #5
    Thread Starter
    Rookie
    Not a Verified Customer
    tedece's Avatar
    Join Date
    Mar 2010
    Location
    Avignon
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Populate Database with custom field (Dropwdown)

    Thanks Pepsi you are so strong !

    You find me the right Thread !!!

    I think i can implement it by myself now...
    Thanks a lot

  6. #6
    pepsi's Avatar
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    14,883
    Thanks
    91
    Thanked 804 Times in 718 Posts

    Re: Populate Database with custom field (Dropwdown)

    No problem

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Adding a custom field below the footer
    By sarge in forum ClassiPress General Discussion
    Replies: 4
    Last Post: August 27th, 2009, 09:42 PM