Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-14-2009, 05:49 PM Action Form
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Hi again

is there any way to avoid to have all the countries listed in a Action Form, making it such way to make appear automatically the countries i a action form when a specific cuntry is introduced is in a data base?

In another words, I do not need to have all the countries listed previously. Only appear the country(ies) when the user(s) fill up a form and intruduce is contry in data base.

Thanks
josil is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-14-2009, 06:01 PM Re: Action Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Yes. ..
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-14-2009, 07:21 PM Re: Action Form
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Yes. ..

Well.... How to do it then?

Can you tell me where can I found a code for it?

thanks
josil is offline
Reply With Quote
View Public Profile
 
Old 12-14-2009, 07:38 PM Re: Action Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.webmaster-talk.com/php-fo...ith-mysql.html

It's simply a matter of reading the data with a query then writing it out into <option> elements with a "for each" or a "while" loop.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-17-2009, 05:15 PM Re: Action Form
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by chrishirst View Post
http://www.webmaster-talk.com/php-fo...ith-mysql.html

It's simply a matter of reading the data with a query then writing it out into <option> elements with a "for each" or a "while" loop.

Hi

Thanks

I will give it a try.

see you
josil is offline
Reply With Quote
View Public Profile
 
Old 12-17-2009, 06:24 PM Re: Action Form
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by josil View Post
Hi

Thanks

I will give it a try.

see you

I just trying but....

Here it is the original form:

Code:
 
<form action="search.php" method="post" enctype="application/x-www-form-urlencoded" name="salerent;
     <select name="rentalperiod" class="salerent" id="rentalperiod">
       <option value="0">Select business type</option>
       <option value="rent"<? if ($rentalperiod == "rent") echo"selected"; ?>>Property for rent</option>
       <option value="sale"<? if ($rentalperiod == "sale") echo"selected"; ?>>Property for sale</option>
     </select>
     
     <select name="countrylet" class="salerent">
        <option value=""<? if($countrylet == "") echo"selected"; ?>>All countries</option>
                    <option value='Acapulco'<? if($countrylet == "Acapulco") echo"selected"; ?>>Acapulco</option>
                    <option value='Afghanistan'<? if($countrylet == "Afghanistan") echo"selected"; ?>>Afghanistan</option>
                    <option value='Albania'<? if($countrylet == "Albania") echo"selected"; ?>>Albania</option>
                    <option value='Algeria'<? if($countrylet == "Algeria") echo"selected"; ?>>Algeria</option>
                    <option value='American Samoa'<? if($countrylet == "American Samoa") echo"selected"; ?>>American Samoa</option>
 
bala...bla...
 
<input name="Submit" type="submit" class="salerent" value="Search">
                  <input name="ord" type="hidden" id="ord" value="id">
                  <input name="ord2" type="hidden" id="ord2" value="asc">
              </form>
taking your example i did:



<form action="search.php" method="post" enctype="application/x-www-form-urlencoded" name="salerent;
<select name="rentalperiod" class="salerent" id="rentalperiod">

<?
while($queryIds->fetchInto($queryId))
{
$id=$queryId["salerent"];
$name=$queryId["countrylet"]." ".$queryId['country'];
$options.="<OPTION VALUE=\"$id\">".$name."</OPTION>";
} // Ene of while
echo "<SELECT NAME='person'>".$options."</SELECT>"; ?>


<option value="0">Select business type</option>
<option value="rent"<? if ($rentalperiod == "rent") echo"selected"; ?>>Property for rent</option>
<option value="sale"<? if ($rentalperiod == "sale") echo"selected"; ?>>Property for sale</option>
</select>

<select name="countrylet" class="salerent">
<option value=""<? if($countrylet == "") echo"selected"; ?>>All countries</option>
<option value='Acapulco'<? if($countrylet == "Acapulco") echo"selected"; ?>>Acapulco</option>
<option value='Afghanistan'<? if($countrylet == "Afghanistan") echo"selected"; ?>>Afghanistan</option>
<option value='Albania'<? if($countrylet == "Albania") echo"selected"; ?>>Albania</option>
<option value='Algeria'<? if($countrylet == "Algeria") echo"selected"; ?>>Algeria</option>
<option value='American Samoa'<? if($countrylet == "American Samoa") echo"selected"; ?>>American Samoa</option>

bala...bla...

<input name="Submit" type="submit" class="salerent" value="Search">
<input name="ord" type="hidden" id="ord" value="id">
<input name="ord2" type="hidden" id="ord2" value="asc">
</form>

[/CODE]
josil is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Action Form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33565 seconds with 12 queries