Jump to content
xisto Community
alex1985

"register.php" The Interesting Point

Recommended Posts

Currently, I making the registration page for my web-site which will appear to be educational. There is the one things I would like to have it inside the registration page.Basically, I want to have a field which is called like "University", when, the user clicks on it, it automatically, lists the Universities based on the chosen country. Therefore, there are supposed to be fields like "Country" and "State or City", on which the University or School will be used.Oh, the entries might be: "School", "College" or "University", and based on them as well as the locations, the educational institutions will be presented in the drop-down menu inside the registration page.Thanks.I will help you will help me or just give me some of the concepts towards doing it.

Share this post


Link to post
Share on other sites

You would need a list of every educational establishment in the world, along with where they are in each country and what type of establishment they are (school, college, university). That data will be very difficult to find, and almost impossible for you to compile yourself.

Share this post


Link to post
Share on other sites

Like I said, the main problem is getting hold of comprehensive worldwide data for educational establishments. If you can provide us with that data then we might be able to integrate it with your form. Otherwise, we don't really have a lot to work with.

Share this post


Link to post
Share on other sites

I agree with rvalkass.
In the U.S. there are 3040 universities. List: http://forums.xisto.com/no_longer_exists/
Whole the world there are hundred thousands of universities.
Do you have to show dropdown menu. Instead the member can type his university. This is easier then collecting the list of all university in the world. Here there is one problem that member can lie. :D

Share this post


Link to post
Share on other sites

All right. Thanks. So, I need to do it manually. So, can you write some sample code over here?

Some sample codes I have written myself, here.

 

If you want to show dropdown menu use this:

 

selectcountry.php

..............<form name="form1" action="selectcountry.php" method="GET">Select your country: <select name="country" onChange="form1.submit();">  <option value="">Select your country</option>  <option value="USA">United States of America</option>  <option value="Turkey">Turkey</option>  <option value="UK">The United Kingdom</option>  <option value="Germany">Germany</option>  <option value="Russia">Russia</option>  <option value="China">China</option>  .............  //place here all the countries in the world :D (by typing all of them or selecting from a query)  .............</select><input type="submit" name="submit1" value="List the universities in this country"></form><?if ($_GET['country']) {?><form name="form2" action="university_selected.php" method="GET"><?$myconnection1 = mysql_connect($db_host , $db_user , $db_password) or die ("Can not connect database:".mysql_error());mysql_select_db( $db_name , $myconnection1 ) or die ("Can not select database:".mysql_error() );$myquery1 = mysql_query("SELECT * FROM university WHERE country=".$_GET['country']." ORDER BY university_long_name ASC",$myconnection1) or die ("Can not select universities:".mysql_error());  if (mysql_num_rows($myquery1)>0) {?><select name="university_id" onChange="form2.submit();"><?	while ($recordset1 = mysql_fetch_array($query1)) {	?><option value="<? echo($recordset1["university_id"]); ?>"><? echo($recordset1["university_long_name"]); ?></option><?	} // while ($recordset1 = mysql_fetch_array($query1)) finishes?></select><input type="submit" name="submit2" value="Select this university"></form><?  } //if (mysql_num_rows($myquery1)>0) finishes  else {?>No university has been found in this country or no university has been written for this country<?  } // else -2 line finishes}  //if ($_GET['country']) finishes?>...................You must analyze the selected university in university_selected.php file.

If you want to show only two editboxes use the following(this is the easiest):

register.php

.................<form name="form1 action="yourfile.php" method="POST">................Type your country: <input type="text" name="country" value=""><br>Type your university: <input type="text" name="university" value=""><br>................</form>.................
:D

As I said before, in the second example, the member applicant can say lie.

 

In the first example, I can write the structure of table "university", if you want to.

Edited by Erdemir (see edit history)

Share this post


Link to post
Share on other sites

Your really serious about finding every university in the world? good luck!You can just use a simple HTML form to list country's and then another one that would list all the universities in that country, then use PHP to enter it into a database.If you want the page to not redirect after the country is selected, you'll need to use AJAX.

Share this post


Link to post
Share on other sites

If you want the page to not redirect after the country is selected, you'll need to use AJAX.

Hey tracdoor, Can you tell us what AJAX is exactly. I hear it much but I don't know how to use it. It is very useful because content is downloading without page redirection. I would like to learn it.

Can you give example codes of using AJAX?

Thanks...

Share this post


Link to post
Share on other sites

AJAX technology is the same as Java language. It makes your web-site more attractive then others. An example, can be a password meter, you know when you type a password, it gives you some result like if it is strong, weak or normal.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.