Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 26th, 2009, 05:44 AM
Authorized User
 
Join Date: Aug 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Question Registration form advice

I wonder if somebody could put me on the right track with a registration form.
I have no problem creating the form, it all works fine. My problem is, if I want to create a registration form that people worldwide can register and is state/province specific.

For example: On the form you have the option to select what country you are from, and for this example you are from South Africa. Now if you select South Africa I want to be able to have another list that would show the 9 provinces of south africa, so you could select, say, KwaZulu Natal.
Or if you selected America, it would give you the option to select which of the 50 or so states you from. The state/province list should only show according to what country you are from.

Does that make sense?

I am not lazy or looking for somebody to write the whole thing out for me but maybe just guide on the right track?

thanks for your time!
Clint
Reply With Quote
  #2 (permalink)  
Old August 26th, 2009, 09:13 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check the following links for similar info:
http://www.phpsimple.net/tutorials/d...dropdown_menu/
http://www.plus2net.com/php_tutorial..._down_list.php
http://www.plus2net.com/javascript_t...pdown-code.php
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
Reply With Quote
The Following User Says Thank You to om_prakash For This Useful Post:
Clint (August 27th, 2009)
  #3 (permalink)  
Old September 16th, 2009, 04:42 AM
Authorized User
 
Join Date: Aug 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hello again...
Could somebody please advise me on the following (and bear with me...Im a newbie)
I was trying out this code for a dependant drop down list for country and state from this site:
http://javascript.internet.com/forms...drop-down.html

It works fine but when I use php to put selected options in the mysql tables I created and display the outcome it displays the country and state code and not the actual name.(for example: I select United Sates and Texas it will display US and TX instead of the whole name, so its saving the codes instead of the names) Im sure I am doing something small wrong but thats what you get for being a newb! I have tried to break down my code as much as possible and maybe somebody could help me in the right direction.

The javascript is at the address above and here is on my page:
this is the code on my page that creates the list boxes and it shows up fine:

Code:
 <td height="21" colspan="2" valign="top"><font color="#FF0000" size="1">Please 
              select your country/state</font> <font color="#FF0000">*</font></td>
            <td></td>
          </tr>
          <tr> 
            <td height="27" valign="top"> 
              <select id='countrySelect' name='country' class="required" onchange='populateState()'>
              </select>
            </td>
            <td valign="top"> 
              <select id='stateSelect' name='state'>
              </select>
              <script type="text/javascript">initCountry('PLS'); </script>
            <td></td>
          </tr>
Then I have this php to send it to mysql table (I am not including the whole page, just the php related to this problem):

Code:
mysql_query("UPDATE users SET
`country` = '$_POST[country]',
`state` = '$_POST[state]',
WHERE id='$_SESSION[user_id]'
") or die(mysql_error());
On the profile page it displays it with this php:

Code:
$result = mysql_query("select * from users where id='$_SESSION[user_id]'");

//grab all the content
while($r=mysql_fetch_array($result))
{	
   //the format is $variable = $r["nameofmysqlcolumn"];
   //modify these to match your mysql table columns
  

   $country=$r["country"];
   $state=$r["state"];

   
   //display the row
   echo " <br> $country <br> $state <br> ";
}
There is a row in the mysql table called country, varchar(200), not null
and the same for state called state.

Appologies in advance for the long post but I thought I better add all details I might need.
Thanks again for your time.

Clint
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a registration form gertho1 BOOK: Beginning ASP.NET 2.0 and Databases 1 April 6th, 2009 02:16 PM
problem in registration form prashant_telkar ASP.NET 1.x and 2.0 Application Design 5 July 11th, 2007 01:09 AM
problem with trigger in registration form prashant_telkar SQL Server 2000 2 July 9th, 2007 06:52 PM
Registration Form Help invisible bunny king Classic ASP Databases 7 February 5th, 2007 05:30 PM
Multiple registration ok??? TheMole BOOK: ASP.NET Website Programming Problem-Design-Solution 7 July 31st, 2005 04:26 PM



All times are GMT -4. The time now is 01:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.