
imperialized
Members-
Posts
100 -
Joined
-
Last visited
Everything posted by imperialized
-
Replacing text with an ajax call (I think?)
imperialized replied to imperialized's topic in Javascript Help
Strange, I ran the page itself without running it through jQuery and the in the SPAN matches the ID in my javscript. I checked this by using an alert("ID is:"+id); and checked the SPAN by running the page and viewing the source. Could it have something to do with the table being called in my ajax? as it is not hard coded in the actual page itself? -
Replacing text with an ajax call (I think?)
imperialized replied to imperialized's topic in Javascript Help
Sorry, I did not include all of the code in my sample code. The code above with the table is just my loop for creating all of the table rows. In fact, there is a table and end table tag, as well as my table headers. Perhaps I was not clear enough with my previous post I will try to focus more directly as to what my problem is. If you look at the above javascript code you will see I have responseCode and responseString. responseCode picks up the OK and the responseString should hold the rest of the output I am returning (which would be the Account has been approved/denied) What I am looking to do is replace the table row that contains the user's information with the responseString. With my code that I have now: responseCode = OK responseString = The account has been approved //If we made it this far everything went OK! echo "ok"; echo "The account has been approved."; So I know my ajax is working correctly, what I am having a problem with is actually replacing the Table Row itself. If you have any more suggestions please let me know. Thanks in advance -
Ok guys, I'm working on building the admin control panel of my website. What I am currently stuck on is this: When a user clicks the link to "Approve Users" a hidden div is shown that lists all accounts that need approval (an AJAX call is made and a new page is shown in the div (list_approvalneeded.php). Within that page there are links that call yet another javascript function to approve/deny the user (again, another page is called delete_user.php (for denying) or approve_user.php (for approvals). All of my code works to delete the user, but I am having trouble with returning the information back to the page. When a user is approved/denied, I wish to replace the listed information for the user with a basic "Account Approved/Account Denied" message. Ok, so now that you understand what I a trying to do I will give you some of the coding that I have used. When listing all of the accounts that need approval I have: while($x = mysql_fetch_array($inactive_query)){ echo "<span id='". $x[id] ."'>"; echo "<tr>"; echo "<td>" . $x['username'] . "</td>"; echo "<td>" . $x['FullName'] . "</td>"; echo "<td>" . $x['Email'] . "</td>"; echo "<td align='center'> <button onclick=\"approve(". $x[id] .")\" id=\"btnApprove\"></button> <button onclick=\"deny(". $x[id] .")\" id=\"btnDeny\"></button> </td>"; echo "</tr>"; echo "</span>"; note: I tried using the SPAN with the same ID as the user to replace the text with my ajax call (this did not work, was just something I tried. The javascript for the delete user is: function deny(id){ var conBox = confirm("Are you sure?" + id); if(conBox){ //They are sure they wish to deny/delete jQuery.ajax({ type: "POST", url: "include/ajax/delete_account.php", data: 'id=' + id, cache: false, success: function(response){ var responseCode = response.substring(0,2); var responseString = response.substring(2); if(responseCode == "ok"){ //Account was deleted $("#"+id).html(responseString); } else { alert("Response is: " + responseString) //Error } } }); } } Note: on my delete_account.php I return a couple things. First, I print an "ok" to know everything was successful, then I print the "Account Denied". That is the reason for my two variables, responseCode and responseString. I am truly stuck, someone please help!!!
-
Bah, after so long you overlook the simple mistakes. Fixed this using z-index.
-
Ok, Im having a little problem. I fixed the menu shifting, but now the menu disappears before it is supposed to. I am really not sure even how to tackle this, any help would be appreciated it. Link: http://www.imperialized.com/new/index.php -- Hover over the top menu link Dropdown. The menu comes as it should, but as you work down the menu it will disappear even though your mouse is still hovered. my CSS for the menu: /** Navigation **/ #navigation { margin-left: 20px; margin-top: 40px; float: left; } #navigation ul{ list-style: none; margin-left: 20px; } #navigation li{ display: inline-block; text-align: center; margin: 0 2px 0 2px; width: 125px; height: 30px; border-radius: 5px; vertical-align: middle; background: #27343C; } #navigation li a.active{ background: #FC4F83; } #navigation a{ color: #FFFFFF; font: bold; text-decoration: none; } #navigation a:hover{ text-decoration: underline; } #navigation li ul{ position: absolute; display: none; } #navigation li:hover > ul { display: block; } /* SUB MENU CSS BELOW */ #navigation li ul li{ display: block; margin-top: -1px; padding: 3px; width: 100px; height: 20px; font-size: 10pt; border-radius: 0px; border-left: 1px solid #6699dd; border-right: 1px solid #6699dd; } #navigation li ul li:first-child{ border-top-left-radius: 5px; border-top-right-radius: 5px; background: #6699dd; display: block; height: 5px; border: 0; width: 101.5px; } #navigation li ul li:first-child:hover, #navigation li ul li:last-child:hover{ background: #6699dd; } #navigation li ul li:last-child{ border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; background: #6699dd; display: block; height: 5px; border: 0; width: 101.5px; } #navigation li ul li a{ text-decoration: none; } #navigation li ul li a:hover{ text-decoration: underline; } #navigation li ul li:hover{ background: #FC4F83; } The navigation menu code: print "<ul> <li class='active'><a href='#'>Home</a></li> <li><a href='#'>Profile</a></li> <li><a href=#>Dropdown</a> <ul> <li> </li> <li><a href=#>Sub Menu</a></li> <li><a href=#>Sub Menu</a></li> <li><a href=#>Sub Menu</a></li> <li><a href=#>Sub Menu</a></li> <li><a href=#>Sub Menu</a></li> <li> </li> </ul></li> "; Any help with this would be greatly appreciated!! Thanks in advance.
-
Hey guys, Im working on my CSS menu for a website I am working on. For some reason I can not figure out why the menu shifts when you hover over. An example can be found here: http://www.imperialized.com/new/index.php You gotta log in to see the dropdown. user: testtest pass: password The CSS for the menu: /** Navigation **/ #navigation { margin-left: 20px; margin-top: 40px; float: left; } #navigation ul{ list-style: none; margin-left: 20px; } #navigation li{ display: inline-block; width: 125px; height: 30px; padding-top: 10px; text-align: center; background: #27343C; border-radius: 5px; } #navigation li:hover{ background: #6699dd; } #navigation li.active{ background: #FC4F83; } #navigation a{ color: #FFFFFF; font: bold; text-decoration: none; } #navigation a:hover{ color: #FFFFFF; text-decoration: underline; } #navigation p{ font-size: 30pt; font-weight: bold; color: #FC4F83; margin-left: 120px; } #navigation li ul{ display: none; } #navigation li ul li a{ height: 12px; font: 8pt; text-decoration: none; } #navigation li ul li a:hover{ height: 12px; font: 8pt; text-decoration: underline; } #navigation li ul li:hover{ background: #FC4F83; } #navigation li:hover > ul { display: block; } The navigation code is as follows includes this: print "<ul> <li class='active'><a href='#'>Home</a></li> <li><a href='#'>Profile</a></li> <li><a href='#'>Gallery</a></li>"; if(isset($_COOKIE['username'])){ //They are logged in, display user menu print "<li><a href=#>$username ∇ </a> <ul> <li><a href=#>Sub Menu</a></li> <li><a href=#>Sub Menu</a></li> <li><a href=#>Sub Menu</a></li> </ul> </li>"; print "</ul>"; } ?> I've played around with relative and absolute positioning, but I am not having any luck. Can someone point me in the right direction? Perhaps a more efficient way of doing this?
-
Ok guys, I am definitely not the best at javascript, but I don't think this is a coding problem. My issue is this: I am writing a registration script using jQuery to do immediate validation. It all works just fine, but I cant figure out the password thing. //CHECK PASSWORD function password_check(){ var password = $('#password').val(); var password1 = $('#password1').val(); if(password == "" || password.length < { $('#password').css('border', '2px red solid'); $('#password_check').html("<img src='img/cross.png' id='cross' /> Password must be 8 characters!"); } else { //Since password is long enough, color it green. $('#password').css('border', '2px green solid'); $('#password_check').html("<img src='img/tick.png' id='tick' />"); //Password is long enough, what about password1? Check em both now. if(password1 == "" || password1.length < { $('#password1').css('border', '2px red solid'); $('#password1_check').html("<img src='img/cross.png' id='cross' /> Password must be 8 characters!"); } else { //Passwords are both long enough, do they match? if(password != password1){ $('#password1').css('border', '2px red solid'); $('#password1_check').html("<img src='img/cross.png' id='cross' /> Passwords do not match!!"); } else { $('#password1').css('border', '2px green solid'); $('#password1_check').html("<img src='img/tick.png' id='tick' />"); } } } } All the code works, but is there a way for me to make it so that the verify password form does not become RED with an error until the user actually starts to type? With this code, as soon as password reaches 8 characters, it automatically errors the verify field.
-
I guess this would be more of an optimization and load time question more so than specific coding question. Anyhow, I was wondering how you all felt about including all styles in a style sheet. For example, my login form will only be displayed on one page, so should I include that in my default stylesheet that is loaded on all pages or have page specific stylesheets for each page that contain those styles that are used solely on that page? /* LOGIN */ #login_container form{ padding: 10px 25px; } #login_text { width: 200px; height: 40px; border: 2px solid #E1EEF5; background: #FFFFFF; text-transform: lowercase; font: bold 16px Arial, Helvetica, sans-serif; color: #000000; border-radius: 5px; padding: 0px 10px 0px 10px; margin-bottom: 3px; } #login_text:hover{ width: 200px; height: 40px; border: 2px solid #2E9AFE; background: #FFFFFF; text-transform: lowercase; font: bold 16px Arial, Helvetica, sans-serif; color: #000000; border-radius: 5px; padding: 0px 10px 0px 10px; margin-bottom: 3px; } .login_submit { float: right; width: 100px; font-weight: bold; margin-left: auto; margin-right: auto; } It seems unnecessary for the browser to read all of that if there is no login that will be displayed, what is your opinion on the matter?
-
Ok, this might get deleted, but I dont know where else to turn for help.. this isnt a code related issue, however most people here are familiar with the inner workings of php. Im running a server from a home pc, latest xampp installed.... I've noticed that my sendmail.exe file (when sending sometimes) opens the cmd.exe and then hangs. I closed about 15 cmd.exe processes tonight when I got off work.. When sending an email through it, it sends the mail but then the website hangs. Restart browser, website will load again. --- I closed all the processes and restarted server and everything is working great. I dont know where to begin
-
Ok, this isnt a problem with the ajax itself (so I put it this forum) The ajax function is called properly and does what its supposed to. However, when it prints back, it prints above my table. Code: if(isset($_SESSION[poker_name]) && $is_admin == "1"){ // THEY ARE LOGGED IN and an Admin print "<table width=450 border=\"1\" cellspacing=\"0\" cellpadding=\"2\"> <tr> <td>From</td> <td>To</td> <td>Amount</td> <td>Date</td> <td>A</td> <td>D</td> </tr> "; $get_transfers = mysql_query("SELECT * FROM transfers WHERE approved = '0'"); while($gt = mysql_fetch_array($get_transfers)){ //While we have transfers loop through and get er done. $formatted = date("m.d.y", $gt[time]); print " <tr> <span id=\"$gt[id]\"> <td>$gt[from]</td> <td>$gt[to]</td> <td>$gt[amount]</td> <td>$formatted</td> <td align=\"center\"><input type=\"button\" onClick=\"ajax($gt[id], 'includes/transfers.php?id=$gt[id]&what=a')\" value=\"Approve\"></td> <td align=\"center\"><input type=\"button\" onClick=\"ajax($gt[id], 'includes/transfers.php?id=$gt[id]&what=d')\" value=\"Deny\"></td> </span> </tr> "; } print "</table>"; Returned from ajax: print "<td colspan=5 align=\"center\"><font color=\"#11FF00\">Transfer Approved</font></td>";
-
I'll make that change now
-
Whoa wait a second... I restarted firefox and its working.. not sure when it started, b/c I was just using F5 to refresh the page. Well its working lol Thanks for all the help guys, I appr it.
-
if(strcasecmp(trim($their_country),trim($current_country)) == 0){ Same thing, prints the list but doesnt select. This is driving me crazy! I've never had a problem like this before. I put the countries into the database using this txt file countries.txt (when highlighted, no spaces are shown at the end of lines) United Kingdom United States Australia New Zealand Canada France South Africa Afghanistan Albania Algeria American Samoa Andorra Angola Anguilla Antarctica Antigua and Barbuda Argentina Armenia Aruba Austria Azerbaijan Bahamas Bahrain Bangladesh Barbados Belarus Belgium Belize Benin Bermuda Bhutan Bolivia Bosnia and Herzegowina Botswana Bouvet Island Brazil British Indian Ocean Terr. Brunei Darussalam Bulgaria Burkina Faso Burundi Cambodia Cameroon Cape Verde Cayman Islands Central African Republic Chad Chile China Christmas Island Cocos (Keeling) Islands Colombia Comoros Congo Cook Islands Costa Rica Cote d'Ivoire Croatia (Hrvatska) Cuba Cyprus Czech Republic Denmark Djibouti Dominica Dominican Republic East Timor Ecuador Egypt El Salvador Equatorial Guinea Eritrea Estonia Ethiopia Falkland Islands/Malvinas Faroe Islands Fiji Finland France France, Metropolitan French Guiana French Polynesia French Southern Terr. Gabon Gambia Georgia Germany Ghana Gibraltar Greece Greenland Grenada Guadeloupe Guam Guatemala Guinea Guinea-Bissau Guyana Haiti Heard & McDonald Is. Honduras Hong Kong Hungary Iceland India Indonesia Iran Iraq Ireland Israel Italy Jamaica Japan Jordan Kazakhstan Kenya Kiribati South Korea Kuwait Kyrgyzstan Lao People's Dem. Rep. Latvia Lebanon Lesotho Liberia Libyan Arab Jamahiriya Liechtenstein Lithuania Luxembourg Macau Macedonia Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands Martinique Mauritania Mauritius Mayotte Mexico Micronesia Moldova Monaco Mongolia Montserrat Morocco Mozambique Myanmar Namibia Nauru Nepal Netherlands Netherlands Antilles New Caledonia New Zealand Nicaragua Niger Nigeria Niue Norfolk Island Northern Mariana Is. Norway Oman Pakistan Palau Panama Papua New Guinea Paraguay Peru Philippines Pitcairn Poland Portugal Puerto Rico Qatar Reunion Romania Russian Federation Rwanda Saint Kitts and Nevis Saint Lucia Samoa San Marino Sao Tome & Principe Saudi Arabia Senegal Seychelles Sierra Leone Singapore Slovakia Slovenia Solomon Islands Somalia South Africa Spain Sri Lanka St. Helena Sudan Suriname Swaziland Sweden Switzerland Syrian Arab Republic Taiwan Tajikistan Tanzania Thailand Togo Tokelau Tonga Trinidad and Tobago Tunisia Turkey Turkmenistan Tuvalu Uganda Ukraine United Arab Emirates United Kingdom U.S. Minor Outlying Is. Uruguay Uzbekistan Vanuatu Vatican Venezuela Viet Nam Virgin Islands (British) Virgin Islands (U.S.) Western Sahara Yemen Yugoslavia Zaire Zambia Zimbabwe When putting them into the database, it uses this: <SELECT NAME="location" id="country_id" SIZE="1"> <OPTION VALUE="1"> Choose One </OPTION> <OPTION VALUE="United Kingdom">United Kingdom</OPTION> <OPTION VALUE="United States">United States</OPTION> <OPTION VALUE="Australia">Australia</OPTION> <OPTION VALUE="New Zealand">New Zealand</OPTION> <OPTION VALUE="Canada">Canada</OPTION> <OPTION VALUE="France">France</OPTION> <OPTION VALUE="South Africa">South Africa</OPTION> <OPTION VALUE="Afghanistan">Afghanistan</OPTION> <OPTION VALUE="Albania">Albania</OPTION> <OPTION VALUE="Algeria">Algeria</OPTION> <OPTION VALUE="American Samoa">American Samoa</OPTION> <OPTION VALUE="Andorra">Andorra</OPTION> <OPTION VALUE="Angola">Angola</OPTION> <OPTION VALUE="Anguilla">Anguilla</OPTION> <OPTION VALUE="Antarctica">Antarctica</OPTION> <OPTION VALUE="Antigua and Barbuda">Antigua and Barbuda</OPTION> <OPTION VALUE="Argentina">Argentina</OPTION> <OPTION VALUE="Armenia">Armenia</OPTION> <OPTION VALUE="Aruba">Aruba</OPTION> <OPTION VALUE="Austria">Austria</OPTION> <OPTION VALUE="Azerbaijan">Azerbaijan</OPTION> <OPTION VALUE="Bahamas">Bahamas</OPTION> <OPTION VALUE="Bahrain">Bahrain</OPTION> <OPTION VALUE="Bangladesh">Bangladesh</OPTION> <OPTION VALUE="Barbados">Barbados</OPTION> <OPTION VALUE="Belarus">Belarus</OPTION> <OPTION VALUE="Belgium">Belgium</OPTION> <OPTION VALUE="Belize">Belize</OPTION> <OPTION VALUE="Benin">Benin</OPTION> <OPTION VALUE="Bermuda">Bermuda</OPTION> <OPTION VALUE="Bhutan">Bhutan</OPTION> <OPTION VALUE="Bolivia">Bolivia</OPTION> <OPTION VALUE="Bosnia and Herzegowina">Bosnia and Herzegowina</OPTION> <OPTION VALUE="Botswana">Botswana</OPTION> <OPTION VALUE="Bouvet Island">Bouvet Island</OPTION> <OPTION VALUE="Brazil">Brazil</OPTION> <OPTION VALUE="British Indian Ocean Terr.">British Indian Ocean Terr.</OPTION> <OPTION VALUE="Brunei Darussalam">Brunei Darussalam</OPTION> <OPTION VALUE="Bulgaria">Bulgaria</OPTION> <OPTION VALUE="Burkina">Burkina Faso</OPTION> <OPTION VALUE="Burundi">Burundi</OPTION> <OPTION VALUE="Cambodia">Cambodia</OPTION> <OPTION VALUE="Cameroon">Cameroon</OPTION> <OPTION VALUE="Cape Verde">Cape Verde</OPTION> <OPTION VALUE="Cayman Islands">Cayman Islands</OPTION> <OPTION VALUE="Central African Republic">Central African Republic</OPTION> <OPTION VALUE="Chad">Chad</OPTION> <OPTION VALUE="Chile">Chile</OPTION> <OPTION VALUE="China">China</OPTION> <OPTION VALUE="Christmas Island">Christmas Island</OPTION> <OPTION VALUE="Cocos (Keeling) Islands">Cocos (Keeling) Islands</OPTION> <OPTION VALUE="Colombia">Colombia</OPTION> <OPTION VALUE="Comoros">Comoros</OPTION> <OPTION VALUE="Congo">Congo</OPTION> <OPTION VALUE="Cook Islands">Cook Islands</OPTION> <OPTION VALUE="Costa Rica">Costa Rica</OPTION> <OPTION VALUE="Cote d'Ivoire">Cote d'Ivoire</OPTION> <OPTION VALUE="Croatia (Hrvatska)">Croatia (Hrvatska)</OPTION> <OPTION VALUE="Cuba">Cuba</OPTION> <OPTION VALUE="Cyprus">Cyprus</OPTION> <OPTION VALUE="Czech Republic">Czech Republic</OPTION> <OPTION VALUE="Denmark">Denmark</OPTION> <OPTION VALUE="Djibouti">Djibouti</OPTION> <OPTION VALUE="Dominica">Dominica</OPTION> <OPTION VALUE="Dominican Republic">Dominican Republic</OPTION> <OPTION VALUE="East Timor">East Timor</OPTION> <OPTION VALUE="Ecuador">Ecuador</OPTION> <OPTION VALUE="Egypt">Egypt</OPTION> <OPTION VALUE="El Salvador">El Salvador</OPTION> <OPTION VALUE="Equatorial Guinea">Equatorial Guinea</OPTION> <OPTION VALUE="Eritrea">Eritrea</OPTION> <OPTION VALUE="Estonia">Estonia</OPTION> <OPTION VALUE="Ethiopia">Ethiopia</OPTION> <OPTION VALUE="Falkland Islands/Malvinas">Falkland Islands/Malvinas</OPTION> <OPTION VALUE="Faroe Islands">Faroe Islands</OPTION> <OPTION VALUE="Fiji">Fiji</OPTION> <OPTION VALUE="Finland">Finland</OPTION> <OPTION VALUE="France">France</OPTION> <OPTION VALUE="France, Metropolitan">France, Metropolitan</OPTION> <OPTION VALUE="French Guiana">French Guiana</OPTION> <OPTION VALUE="French Polynesia">French Polynesia</OPTION> <OPTION VALUE="French Southern Terr.">French Southern Terr.</OPTION> <OPTION VALUE="Gabon">Gabon</OPTION> <OPTION VALUE="Gambia">Gambia</OPTION> <OPTION VALUE="Georgia">Georgia</OPTION> <OPTION VALUE="Germany">Germany</OPTION> <OPTION VALUE="Ghana">Ghana</OPTION> <OPTION VALUE="Gibraltar">Gibraltar</OPTION> <OPTION VALUE="Greece">Greece</OPTION> <OPTION VALUE="Greenland">Greenland</OPTION> <OPTION VALUE="Grenada">Grenada</OPTION> <OPTION VALUE="Guadeloupe">Guadeloupe</OPTION> <OPTION VALUE="Guam">Guam</OPTION> <OPTION VALUE="Guatemala">Guatemala</OPTION> <OPTION VALUE="Guinea">Guinea</OPTION> <OPTION VALUE="Guinea-Bissau">Guinea-Bissau</OPTION> <OPTION VALUE="Guyana">Guyana</OPTION> <OPTION VALUE="Haiti">Haiti</OPTION> <OPTION VALUE="Heard & McDonald Is.">Heard & McDonald Is.</OPTION> <OPTION VALUE="Honduras">Honduras</OPTION> <OPTION VALUE="Hong Kong">Hong Kong</OPTION> <OPTION VALUE="Hungary">Hungary</OPTION> <OPTION VALUE="Iceland">Iceland</OPTION> <OPTION VALUE="India">India</OPTION> <OPTION VALUE="Indonesia">Indonesia</OPTION> <OPTION VALUE="Iran">Iran</OPTION> <OPTION VALUE="Iraq">Iraq</OPTION> <OPTION VALUE="Ireland">Ireland</OPTION> <OPTION VALUE="Israel">Israel</OPTION> <OPTION VALUE="Italy">Italy</OPTION> <OPTION VALUE="Jamaica">Jamaica</OPTION> <OPTION VALUE="Japan">Japan</OPTION> <OPTION VALUE="Jordan">Jordan</OPTION> <OPTION VALUE="Kazakhstan">Kazakhstan</OPTION> <OPTION VALUE="Kenya">Kenya</OPTION> <OPTION VALUE="Kiribati">Kiribati</OPTION> <OPTION VALUE="South Korea">South Korea</OPTION> <OPTION VALUE="Kuwait">Kuwait</OPTION> <OPTION VALUE="Kyrgyzstan">Kyrgyzstan</OPTION> <OPTION VALUE="Lao People's Dem. Rep.">Lao People's Dem. Rep.</OPTION> <OPTION VALUE="Latvia">Latvia</OPTION> <OPTION VALUE="Lebanon">Lebanon</OPTION> <OPTION VALUE="Lesotho">Lesotho</OPTION> <OPTION VALUE="Liberia">Liberia</OPTION> <OPTION VALUE="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</OPTION> <OPTION VALUE="Liechtenstein">Liechtenstein</OPTION> <OPTION VALUE="Lithuania">Lithuania</OPTION> <OPTION VALUE="Luxembourg">Luxembourg</OPTION> <OPTION VALUE="Macau">Macau</OPTION> <OPTION VALUE="Macedonia">Macedonia</OPTION> <OPTION VALUE="Madagascar">Madagascar</OPTION> <OPTION VALUE="Malawi">Malawi</OPTION> <OPTION VALUE="Malaysia">Malaysia</OPTION> <OPTION VALUE="Maldives">Maldives</OPTION> <OPTION VALUE="Mali">Mali</OPTION> <OPTION VALUE="Malta">Malta</OPTION> <OPTION VALUE="Marshall Islands">Marshall Islands</OPTION> <OPTION VALUE="Martinique">Martinique</OPTION> <OPTION VALUE="Mauritania">Mauritania</OPTION> <OPTION VALUE="Mauritius">Mauritius</OPTION> <OPTION VALUE="Mayotte">Mayotte</OPTION> <OPTION VALUE="Mexico">Mexico</OPTION> <OPTION VALUE="Micronesia">Micronesia</OPTION> <OPTION VALUE="Moldova">Moldova</OPTION> <OPTION VALUE="Monaco">Monaco</OPTION> <OPTION VALUE="Mongolia">Mongolia</OPTION> <OPTION VALUE="Montserrat">Montserrat</OPTION> <OPTION VALUE="Morocco">Morocco</OPTION> <OPTION VALUE="Mozambique">Mozambique</OPTION> <OPTION VALUE="Myanmar">Myanmar</OPTION> <OPTION VALUE="Namibia">Namibia</OPTION> <OPTION VALUE="Nauru">Nauru</OPTION> <OPTION VALUE="Nepal">Nepal</OPTION> <OPTION VALUE="Netherlands">Netherlands</OPTION> <OPTION VALUE="Netherlands Antilles">Netherlands Antilles</OPTION> <OPTION VALUE="New Caledonia">New Caledonia</OPTION> <OPTION VALUE="New Zealand">New Zealand</OPTION> <OPTION VALUE="Nicaragua">Nicaragua</OPTION> <OPTION VALUE="Niger">Niger</OPTION> <OPTION VALUE="Nigeria">Nigeria</OPTION> <OPTION VALUE="Niue">Niue</OPTION> <OPTION VALUE="Norfolk Island">Norfolk Island</OPTION> <OPTION VALUE="Northern Mariana Is.">Northern Mariana Is.</OPTION> <OPTION VALUE="Norway">Norway</OPTION> <OPTION VALUE="Oman">Oman</OPTION> <OPTION VALUE="Pakistan">Pakistan</OPTION> <OPTION VALUE="Palau">Palau</OPTION> <OPTION VALUE="Panama">Panama</OPTION> <OPTION VALUE="Papua New Guinea">Papua New Guinea</OPTION> <OPTION VALUE="Paraguay">Paraguay</OPTION> <OPTION VALUE="Peru">Peru</OPTION> <OPTION VALUE="Philippines">Philippines</OPTION> <OPTION VALUE="Pitcairn">Pitcairn</OPTION> <OPTION VALUE="Poland">Poland</OPTION> <OPTION VALUE="Portugal">Portugal</OPTION> <OPTION VALUE="Puerto Rico">Puerto Rico</OPTION> <OPTION VALUE="Qatar">Qatar</OPTION> <OPTION VALUE="Reunion">Reunion</OPTION> <OPTION VALUE="Romania">Romania</OPTION> <OPTION VALUE="Russian Federation">Russian Federation</OPTION> <OPTION VALUE="Rwanda">Rwanda</OPTION> <OPTION VALUE="Saint Kitts and Nevis">Saint Kitts and Nevis</OPTION> <OPTION VALUE="Saint Lucia">Saint Lucia</OPTION> <OPTION VALUE="Samoa">Samoa</OPTION> <OPTION VALUE="San Marino">San Marino</OPTION> <OPTION VALUE="Sao Tome & Principe">Sao Tome & Principe</OPTION> <OPTION VALUE="Saudi Arabia">Saudi Arabia</OPTION> <OPTION VALUE="Senegal">Senegal</OPTION> <OPTION VALUE="Seychelles">Seychelles</OPTION> <OPTION VALUE="Sierra Leone">Sierra Leone</OPTION> <OPTION VALUE="Singapore">Singapore</OPTION> <OPTION VALUE="Slovakia">Slovakia </OPTION> <OPTION VALUE="Slovenia">Slovenia</OPTION> <OPTION VALUE="Solomon Islands">Solomon Islands</OPTION> <OPTION VALUE="Somalia">Somalia</OPTION> <OPTION VALUE="South Africa">South Africa</OPTION> <OPTION VALUE="Spain">Spain</OPTION> <OPTION VALUE="Sri Lanka">Sri Lanka</OPTION> <OPTION VALUE="St. Helena">St. Helena</OPTION> <OPTION VALUE="Sudan">Sudan</OPTION> <OPTION VALUE="Suriname">Suriname</OPTION> <OPTION VALUE="Swaziland">Swaziland</OPTION> <OPTION VALUE="Sweden">Sweden</OPTION> <OPTION VALUE="Switzerland">Switzerland</OPTION> <OPTION VALUE="Syrian Arab Republic">Syrian Arab Republic</OPTION> <OPTION VALUE="Taiwan">Taiwan</OPTION> <OPTION VALUE="Tajikistan">Tajikistan</OPTION> <OPTION VALUE="Tanzania">Tanzania</OPTION> <OPTION VALUE="Thailand">Thailand</OPTION> <OPTION VALUE="Togo">Togo</OPTION> <OPTION VALUE="Tokelau">Tokelau</OPTION> <OPTION VALUE="Tonga">Tonga</OPTION> <OPTION VALUE="Trinidad and Tobago">Trinidad and Tobago</OPTION> <OPTION VALUE="Tunisia">Tunisia</OPTION> <OPTION VALUE="Turkey">Turkey</OPTION> <OPTION VALUE="Turkmenistan">Turkmenistan</OPTION> <OPTION VALUE="Tuvalu">Tuvalu</OPTION> <OPTION VALUE="Uganda">Uganda</OPTION> <OPTION VALUE="Ukraine">Ukraine</OPTION> <OPTION VALUE="United Arab Emirates">United Arab Emirates</OPTION> <OPTION VALUE="United Kingdom">United Kingdom</OPTION> <OPTION VALUE="U.S. Minor Outlying Is.">U.S. Minor Outlying Is.</OPTION> <OPTION VALUE="Uruguay">Uruguay</OPTION> <OPTION VALUE="Uzbekistan">Uzbekistan</OPTION> <OPTION VALUE="Vanuatu">Vanuatu</OPTION> <OPTION VALUE="Vatican">Vatican</OPTION> <OPTION VALUE="Venezuela">Venezuela</OPTION> <OPTION VALUE="Viet Nam">Viet Nam</OPTION> <OPTION VALUE="Virgin Islands (British)">Virgin Islands (British)</OPTION> <OPTION VALUE="Virgin Islands (U.S.)">Virgin Islands (U.S.)</OPTION> <OPTION VALUE="Western Sahara">Western Sahara</OPTION> <OPTION VALUE="Yemen">Yemen</OPTION> <OPTION VALUE="Yugoslavia">Yugoslavia</OPTION> <OPTION VALUE="Zaire">Zaire</OPTION> <OPTION VALUE="Zambia">Zambia</OPTION> <OPTION VALUE="Zimbabwe">Zimbabwe</OPTION> </SELECT> Sorry for the excessively long posts =\ It doesn't appear to be any spaces, however.
-
I had to comment out the <select> in order to print the vars (cant print them inside, you know what im saying. but here is the result) France : United States France : Afghanistan France : Albania France : Algeria France : American Samoa France : Andorra France : Angola France : Anguilla France : Antarctica France : Antigua and Barbuda France : Argentina France : Armenia France : Aruba France : Austria France : Azerbaijan France : Bahamas France : Bahrain France : Bangladesh France : Barbados France : Belarus France : Belgium France : Belize France : Benin France : Bermuda France : Bhutan France : Bolivia France : Bosnia and Herzegowina France : Botswana France : Bouvet Island France : Brazil France : British Indian Ocean Terr. France : Brunei Darussalam France : Bulgaria France : Burkina Faso France : Burundi France : Cambodia France : Cameroon France : Cape Verde France : Cayman Islands France : Central African Republic France : Chad France : Chile France : China France : Christmas Island France : Cocos (Keeling) Islands France : Colombia France : Comoros France : Congo France : Cook Islands France : Costa Rica France : Croatia (Hrvatska) France : Cuba France : Cyprus France : Czech Republic France : Denmark France : Djibouti France : Dominica France : Dominican Republic France : East Timor France : Ecuador France : Egypt France : El Salvador France : Equatorial Guinea France : Eritrea France : Estonia France : Ethiopia France : Falkland Islands/Malvinas France : Faroe Islands France : Fiji France : Finland France : France France : France, Metropolitan France : French Guiana France : French Polynesia France : French Southern Terr. France : Gabon France : Gambia France : Georgia France : Germany France : Ghana France : Gibraltar France : Greece France : Greenland France : Grenada France : Guadeloupe France : Guam France : Guatemala France : Guinea France : Guinea-Bissau France : Guyana France : Haiti France : Heard & McDonald Is. France : Honduras France : Hong Kong France : Hungary France : Iceland France : India France : Indonesia France : Iran France : Iraq France : Ireland France : Israel France : Italy France : Jamaica France : Japan France : Jordan France : Kazakhstan France : Kenya France : Kiribati France : South Korea France : Kuwait France : Kyrgyzstan France : Latvia France : Lebanon France : Lesotho France : Liberia France : Libyan Arab Jamahiriya France : Liechtenstein France : Lithuania France : Luxembourg France : Macau France : Macedonia France : Madagascar France : Malawi France : Malaysia France : Maldives France : Mali France : Malta France : Marshall Islands France : Martinique France : Mauritania France : Mauritius France : Mayotte France : Mexico France : Micronesia France : Moldova France : Monaco France : Mongolia France : Montserrat France : Morocco France : Mozambique France : Myanmar France : Namibia France : Nauru France : Nepal France : Netherlands France : Netherlands Antilles France : New Caledonia France : New Zealand France : Nicaragua France : Niger France : Nigeria France : Niue France : Norfolk Island France : Northern Mariana Is. France : Norway France : Oman France : Pakistan France : Palau France : Panama France : Papua New Guinea France : Paraguay France : Peru France : Philippines France : Pitcairn France : Poland France : Portugal France : Puerto Rico France : Qatar France : Reunion France : Romania France : Russian Federation France : Rwanda France : Saint Kitts and Nevis France : Saint Lucia France : Samoa France : San Marino France : Sao Tome & Principe France : Saudi Arabia France : Senegal France : Seychelles France : Sierra Leone France : Singapore France : Slovakia France : Slovenia France : Solomon Islands France : Somalia France : South Africa France : Spain France : Sri Lanka France : St. Helena France : Sudan France : Suriname France : Swaziland France : Sweden France : Switzerland France : Syrian Arab Republic France : Taiwan France : Tajikistan France : Tanzania France : Thailand France : Togo France : Tokelau France : Tonga France : Trinidad and Tobago France : Tunisia France : Turkey France : Turkmenistan France : Tuvalu France : Uganda France : Ukraine France : United Arab Emirates France : United Kingdom France : U.S. Minor Outlying Is. France : Uruguay France : Uzbekistan France : Vanuatu France : Vatican France : Venezuela France : Viet Nam France : Virgin Islands (British) France : Virgin Islands (U.S.) France : Western Sahara France : Yemen France : Yugoslavia France : Zaire France : Zambia France : Zimbabwe Code $their_country = $x[location]; $country = mysql_query("SELECT * FROM countries ORDER BY id ASC"); while($z = mysql_fetch_array($country)){ $current_country = $z[country]; echo $their_country . " : " . $current_country . "<br/>"; if(strcasecmp($their_country,$current_country) == 0){ //not theirs //print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } else { //their //print "<option value=\"$current_country\">$current_country</option>"; } }
-
Tried it both ways, makes no difference, although the reason I use <> is b/c the if statement decides which to print. if its not 0, its not the same. while($z = mysql_fetch_array($country)){ $current_country = $z[country]; if(strcasecmp($their_country,$current_country) == 0){ //not theirs print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } else { //their print "<option value=\"$current_country\">$current_country</option>"; }
-
if(strcasecmp($their_country,$current_country) <> 0){ //not theirs print "<option value=\"$current_country\">$current_country</option>"; } else { //theirs print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } Still does not work.. $x[location] is set prior when I query the account info. //Get all of their account information. $get_account_query = mysql_query("SELECT * FROM poker_users WHERE poker_name = '$poker_name' LIMIT 1;"); //Make sure the account exists if(mysql_num_rows($get_account_query) > 0){ //Account exists, make a loop! $x = mysql_fetch_assoc($get_account_query); However, both of the variables print as they should... just wont compare correctly?
-
Ok guys, I am completely confused as to why this isnt working.. I've tried everything so I post it here. $their_country = $x[location]; $country = mysql_query("SELECT * FROM countries ORDER BY id ASC"); while($z = mysql_fetch_array($country)){ $current_country = $z[country]; if($their_country <> $current_country){ //not theirs print "<option value=\"$current_country\">$current_country</option>"; } else { //theirs print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } } $their_country = prints France (which is good) $current_country = prints whichever is pulled from the database in the loop (good too) tried just using the $x[location] and $z[country] to compare, fails. tried using === to compare, fails tried putting quotes around each string in the if statement, fails -- The code itself works, it just doesn't select the country. When (View Source) no option in the <select> menu has the SELECTED tag added to it.
-
Just put it in a database, might as well do it correctly. Thanks for the hlep guys
-
country_list.php print " <SELECT NAME=\"location\" id=\"country_id\" SIZE=\"1\"> <OPTION VALUE=\"1\"> Choose One </OPTION> <OPTION VALUE=\"United Kingdom\">United Kingdom</OPTION> <OPTION VALUE=\"United States\">United States</OPTION> <OPTION VALUE=\"Australia\">Australia</OPTION> <OPTION VALUE=\"New Zealand\">New Zealand</OPTION> <OPTION VALUE=\"Canada\">Canada</OPTION> <OPTION VALUE=\"France\">France</OPTION> <OPTION VALUE=\"South Africa\">South Africa</OPTION> <OPTION VALUE=\"Afghanistan\">Afghanistan</OPTION> <OPTION VALUE=\"Albania\">Albania</OPTION> <OPTION VALUE=\"Algeria\">Algeria</OPTION> <OPTION VALUE=\"American Samoa\">American Samoa</OPTION> <OPTION VALUE=\"Andorra\">Andorra</OPTION> <OPTION VALUE=\"Angola\">Angola</OPTION> <OPTION VALUE=\"Anguilla\">Anguilla</OPTION> <OPTION VALUE=\"Antarctica\">Antarctica</OPTION> <OPTION VALUE=\"Antigua and Barbuda\">Antigua and Barbuda</OPTION> <OPTION VALUE=\"Argentina\">Argentina</OPTION> <OPTION VALUE=\"Armenia\">Armenia</OPTION> <OPTION VALUE=\"Aruba\">Aruba</OPTION> <OPTION VALUE=\"Austria\">Austria</OPTION> <OPTION VALUE=\"Azerbaijan\">Azerbaijan</OPTION> <OPTION VALUE=\"Bahamas\">Bahamas</OPTION> <OPTION VALUE=\"Bahrain\">Bahrain</OPTION> <OPTION VALUE=\"Bangladesh\">Bangladesh</OPTION> <OPTION VALUE=\"Barbados\">Barbados</OPTION> <OPTION VALUE=\"Belarus\">Belarus</OPTION> <OPTION VALUE=\"Belgium\">Belgium</OPTION> <OPTION VALUE=\"Belize\">Belize</OPTION> <OPTION VALUE=\"Benin\">Benin</OPTION> <OPTION VALUE=\"Bermuda\">Bermuda</OPTION> <OPTION VALUE=\"Bhutan\">Bhutan</OPTION> <OPTION VALUE=\"Bolivia\">Bolivia</OPTION> <OPTION VALUE=\"Bosnia and Herzegowina\">Bosnia and Herzegowina</OPTION> <OPTION VALUE=\"Botswana\">Botswana</OPTION> <OPTION VALUE=\"Bouvet Island\">Bouvet Island</OPTION> <OPTION VALUE=\"Brazil\">Brazil</OPTION> <OPTION VALUE=\"British Indian Ocean Terr.\">British Indian Ocean Terr.</OPTION> <OPTION VALUE=\"Brunei Darussalam\">Brunei Darussalam</OPTION> <OPTION VALUE=\"Bulgaria\">Bulgaria</OPTION> <OPTION VALUE=\"Burkina\">Burkina Faso</OPTION> <OPTION VALUE=\"Burundi\">Burundi</OPTION> <OPTION VALUE=\"Cambodia\">Cambodia</OPTION> <OPTION VALUE=\"Cameroon\">Cameroon</OPTION> <OPTION VALUE=\"Cape Verde\">Cape Verde</OPTION> <OPTION VALUE=\"Cayman Islands\">Cayman Islands</OPTION> <OPTION VALUE=\"Central African Republic\">Central African Republic</OPTION> <OPTION VALUE=\"Chad\">Chad</OPTION> <OPTION VALUE=\"Chile\">Chile</OPTION> <OPTION VALUE=\"China\">China</OPTION> <OPTION VALUE=\"Christmas Island\">Christmas Island</OPTION> <OPTION VALUE=\"Cocos (Keeling) Islands\">Cocos (Keeling) Islands</OPTION> <OPTION VALUE=\"Colombia\">Colombia</OPTION> <OPTION VALUE=\"Comoros\">Comoros</OPTION> <OPTION VALUE=\"Congo\">Congo</OPTION> <OPTION VALUE=\"Cook Islands\">Cook Islands</OPTION> <OPTION VALUE=\"Costa Rica\">Costa Rica</OPTION> <OPTION VALUE=\"Cote d'Ivoire\">Cote d'Ivoire</OPTION> <OPTION VALUE=\"Croatia (Hrvatska)\">Croatia (Hrvatska)</OPTION> <OPTION VALUE=\"Cuba\">Cuba</OPTION> <OPTION VALUE=\"Cyprus\">Cyprus</OPTION> <OPTION VALUE=\"Czech Republic\">Czech Republic</OPTION> <OPTION VALUE=\"Denmark\">Denmark</OPTION> <OPTION VALUE=\"Djibouti\">Djibouti</OPTION> <OPTION VALUE=\"Dominica\">Dominica</OPTION> <OPTION VALUE=\"Dominican Republic\">Dominican Republic</OPTION> <OPTION VALUE=\"East Timor\">East Timor</OPTION> <OPTION VALUE=\"Ecuador\">Ecuador</OPTION> <OPTION VALUE=\"Egypt\">Egypt</OPTION> <OPTION VALUE=\"El Salvador\">El Salvador</OPTION> <OPTION VALUE=\"Equatorial Guinea\">Equatorial Guinea</OPTION> <OPTION VALUE=\"Eritrea\">Eritrea</OPTION> <OPTION VALUE=\"Estonia\">Estonia</OPTION> <OPTION VALUE=\"Ethiopia\">Ethiopia</OPTION> <OPTION VALUE=\"Falkland Islands/Malvinas\">Falkland Islands/Malvinas</OPTION> <OPTION VALUE=\"Faroe Islands\">Faroe Islands</OPTION> <OPTION VALUE=\"Fiji\">Fiji</OPTION> <OPTION VALUE=\"Finland\">Finland</OPTION> <OPTION VALUE=\"France\">France</OPTION> <OPTION VALUE=\"France, Metropolitan\">France, Metropolitan</OPTION> <OPTION VALUE=\"French Guiana\">French Guiana</OPTION> <OPTION VALUE=\"French Polynesia\">French Polynesia</OPTION> <OPTION VALUE=\"French Southern Terr.\">French Southern Terr.</OPTION> <OPTION VALUE=\"Gabon\">Gabon</OPTION> <OPTION VALUE=\"Gambia\">Gambia</OPTION> <OPTION VALUE=\"Georgia\">Georgia</OPTION> <OPTION VALUE=\"Germany\">Germany</OPTION> <OPTION VALUE=\"Ghana\">Ghana</OPTION> <OPTION VALUE=\"Gibraltar\">Gibraltar</OPTION> <OPTION VALUE=\"Greece\">Greece</OPTION> <OPTION VALUE=\"Greenland\">Greenland</OPTION> <OPTION VALUE=\"Grenada\">Grenada</OPTION> <OPTION VALUE=\"Guadeloupe\">Guadeloupe</OPTION> <OPTION VALUE=\"Guam\">Guam</OPTION> <OPTION VALUE=\"Guatemala\">Guatemala</OPTION> <OPTION VALUE=\"Guinea\">Guinea</OPTION> <OPTION VALUE=\"Guinea-Bissau\">Guinea-Bissau</OPTION> <OPTION VALUE=\"Guyana\">Guyana</OPTION> <OPTION VALUE=\"Haiti\">Haiti</OPTION> <OPTION VALUE=\"Heard & McDonald Is.\">Heard & McDonald Is.</OPTION> <OPTION VALUE=\"Honduras\">Honduras</OPTION> <OPTION VALUE=\"Hong Kong\">Hong Kong</OPTION> <OPTION VALUE=\"Hungary\">Hungary</OPTION> <OPTION VALUE=\"Iceland\">Iceland</OPTION> <OPTION VALUE=\"India\">India</OPTION> <OPTION VALUE=\"Indonesia\">Indonesia</OPTION> <OPTION VALUE=\"Iran\">Iran</OPTION> <OPTION VALUE=\"Iraq\">Iraq</OPTION> <OPTION VALUE=\"Ireland\">Ireland</OPTION> <OPTION VALUE=\"Israel\">Israel</OPTION> <OPTION VALUE=\"Italy\">Italy</OPTION> <OPTION VALUE=\"Jamaica\">Jamaica</OPTION> <OPTION VALUE=\"Japan\">Japan</OPTION> <OPTION VALUE=\"Jordan\">Jordan</OPTION> <OPTION VALUE=\"Kazakhstan\">Kazakhstan</OPTION> <OPTION VALUE=\"Kenya\">Kenya</OPTION> <OPTION VALUE=\"Kiribati\">Kiribati</OPTION> <OPTION VALUE=\"South Korea\">South Korea</OPTION> <OPTION VALUE=\"Kuwait\">Kuwait</OPTION> <OPTION VALUE=\"Kyrgyzstan\">Kyrgyzstan</OPTION> <OPTION VALUE=\"Lao People's Dem. Rep.\">Lao People's Dem. Rep.</OPTION> <OPTION VALUE=\"Latvia\">Latvia</OPTION> <OPTION VALUE=\"Lebanon\">Lebanon</OPTION> <OPTION VALUE=\"Lesotho\">Lesotho</OPTION> <OPTION VALUE=\"Liberia\">Liberia</OPTION> <OPTION VALUE=\"Libyan Arab Jamahiriya\">Libyan Arab Jamahiriya</OPTION> <OPTION VALUE=\"Liechtenstein\">Liechtenstein</OPTION> <OPTION VALUE=\"Lithuania\">Lithuania</OPTION> <OPTION VALUE=\"Luxembourg\">Luxembourg</OPTION> <OPTION VALUE=\"Macau\">Macau</OPTION> <OPTION VALUE=\"Macedonia\">Macedonia</OPTION> <OPTION VALUE=\"Madagascar\">Madagascar</OPTION> <OPTION VALUE=\"Malawi\">Malawi</OPTION> <OPTION VALUE=\"Malaysia\">Malaysia</OPTION> <OPTION VALUE=\"Maldives\">Maldives</OPTION> <OPTION VALUE=\"Mali\">Mali</OPTION> <OPTION VALUE=\"Malta\">Malta</OPTION> <OPTION VALUE=\"Marshall Islands\">Marshall Islands</OPTION> <OPTION VALUE=\"Martinique\">Martinique</OPTION> <OPTION VALUE=\"Mauritania\">Mauritania</OPTION> <OPTION VALUE=\"Mauritius\">Mauritius</OPTION> <OPTION VALUE=\"Mayotte\">Mayotte</OPTION> <OPTION VALUE=\"Mexico\">Mexico</OPTION> <OPTION VALUE=\"Micronesia\">Micronesia</OPTION> <OPTION VALUE=\"Moldova\">Moldova</OPTION> <OPTION VALUE=\"Monaco\">Monaco</OPTION> <OPTION VALUE=\"Mongolia\">Mongolia</OPTION> <OPTION VALUE=\"Montserrat\">Montserrat</OPTION> <OPTION VALUE=\"Morocco\">Morocco</OPTION> <OPTION VALUE=\"Mozambique\">Mozambique</OPTION> <OPTION VALUE=\"Myanmar\">Myanmar</OPTION> <OPTION VALUE=\"Namibia\">Namibia</OPTION> <OPTION VALUE=\"Nauru\">Nauru</OPTION> <OPTION VALUE=\"Nepal\">Nepal</OPTION> <OPTION VALUE=\"Netherlands\">Netherlands</OPTION> <OPTION VALUE=\"Netherlands Antilles\">Netherlands Antilles</OPTION> <OPTION VALUE=\"New Caledonia\">New Caledonia</OPTION> <OPTION VALUE=\"New Zealand\">New Zealand</OPTION> <OPTION VALUE=\"Nicaragua\">Nicaragua</OPTION> <OPTION VALUE=\"Niger\">Niger</OPTION> <OPTION VALUE=\"Nigeria\">Nigeria</OPTION> <OPTION VALUE=\"Niue\">Niue</OPTION> <OPTION VALUE=\"Norfolk Island\">Norfolk Island</OPTION> <OPTION VALUE=\"Northern Mariana Is.\">Northern Mariana Is.</OPTION> <OPTION VALUE=\"Norway\">Norway</OPTION> <OPTION VALUE=\"Oman\">Oman</OPTION> <OPTION VALUE=\"Pakistan\">Pakistan</OPTION> <OPTION VALUE=\"Palau\">Palau</OPTION> <OPTION VALUE=\"Panama\">Panama</OPTION> <OPTION VALUE=\"Papua New Guinea\">Papua New Guinea</OPTION> <OPTION VALUE=\"Paraguay\">Paraguay</OPTION> <OPTION VALUE=\"Peru\">Peru</OPTION> <OPTION VALUE=\"Philippines\">Philippines</OPTION> <OPTION VALUE=\"Pitcairn\">Pitcairn</OPTION> <OPTION VALUE=\"Poland\">Poland</OPTION> <OPTION VALUE=\"Portugal\">Portugal</OPTION> <OPTION VALUE=\"Puerto Rico\">Puerto Rico</OPTION> <OPTION VALUE=\"Qatar\">Qatar</OPTION> <OPTION VALUE=\"Reunion\">Reunion</OPTION> <OPTION VALUE=\"Romania\">Romania</OPTION> <OPTION VALUE=\"Russian Federation\">Russian Federation</OPTION> <OPTION VALUE=\"Rwanda\">Rwanda</OPTION> <OPTION VALUE=\"Saint Kitts and Nevis\">Saint Kitts and Nevis</OPTION> <OPTION VALUE=\"Saint Lucia\">Saint Lucia</OPTION> <OPTION VALUE=\"Samoa\">Samoa</OPTION> <OPTION VALUE=\"San Marino\">San Marino</OPTION> <OPTION VALUE=\"Sao Tome & Principe\">Sao Tome & Principe</OPTION> <OPTION VALUE=\"Saudi Arabia\">Saudi Arabia</OPTION> <OPTION VALUE=\"Senegal\">Senegal</OPTION> <OPTION VALUE=\"Seychelles\">Seychelles</OPTION> <OPTION VALUE=\"Sierra Leone\">Sierra Leone</OPTION> <OPTION VALUE=\"Singapore\">Singapore</OPTION> <OPTION VALUE=\"Slovakia\">Slovakia </OPTION> <OPTION VALUE=\"Slovenia\">Slovenia</OPTION> <OPTION VALUE=\"Solomon Islands\">Solomon Islands</OPTION> <OPTION VALUE=\"Somalia\">Somalia</OPTION> <OPTION VALUE=\"South Africa\">South Africa</OPTION> <OPTION VALUE=\"Spain\">Spain</OPTION> <OPTION VALUE=\"Sri Lanka\">Sri Lanka</OPTION> <OPTION VALUE=\"St. Helena\">St. Helena</OPTION> <OPTION VALUE=\"Sudan\">Sudan</OPTION> <OPTION VALUE=\"Suriname\">Suriname</OPTION> <OPTION VALUE=\"Swaziland\">Swaziland</OPTION> <OPTION VALUE=\"Sweden\">Sweden</OPTION> <OPTION VALUE=\"Switzerland\">Switzerland</OPTION> <OPTION VALUE=\"Syrian Arab Republic\">Syrian Arab Republic</OPTION> <OPTION VALUE=\"Taiwan\">Taiwan</OPTION> <OPTION VALUE=\"Tajikistan\">Tajikistan</OPTION> <OPTION VALUE=\"Tanzania\">Tanzania</OPTION> <OPTION VALUE=\"Thailand\">Thailand</OPTION> <OPTION VALUE=\"Togo\">Togo</OPTION> <OPTION VALUE=\"Tokelau\">Tokelau</OPTION> <OPTION VALUE=\"Tonga\">Tonga</OPTION> <OPTION VALUE=\"Trinidad and Tobago\">Trinidad and Tobago</OPTION> <OPTION VALUE=\"Tunisia\">Tunisia</OPTION> <OPTION VALUE=\"Turkey\">Turkey</OPTION> <OPTION VALUE=\"Turkmenistan\">Turkmenistan</OPTION> <OPTION VALUE=\"Tuvalu\">Tuvalu</OPTION> <OPTION VALUE=\"Uganda\">Uganda</OPTION> <OPTION VALUE=\"Ukraine\">Ukraine</OPTION> <OPTION VALUE=\"United Arab Emirates\">United Arab Emirates</OPTION> <OPTION VALUE=\"United Kingdom\">United Kingdom</OPTION> <OPTION VALUE=\"U.S. Minor Outlying Is.\">U.S. Minor Outlying Is.</OPTION> <OPTION VALUE=\"Uruguay\">Uruguay</OPTION> <OPTION VALUE=\"Uzbekistan\">Uzbekistan</OPTION> <OPTION VALUE=\"Vanuatu\">Vanuatu</OPTION> <OPTION VALUE=\"Vatican\">Vatican</OPTION> <OPTION VALUE=\"Venezuela\">Venezuela</OPTION> <OPTION VALUE=\"Viet Nam\">Viet Nam</OPTION> <OPTION VALUE=\"Virgin Islands (British)\">Virgin Islands (British)</OPTION> <OPTION VALUE=\"Virgin Islands (U.S.)\">Virgin Islands (U.S.)</OPTION> <OPTION VALUE=\"Western Sahara\">Western Sahara</OPTION> <OPTION VALUE=\"Yemen\">Yemen</OPTION> <OPTION VALUE=\"Yugoslavia\">Yugoslavia</OPTION> <OPTION VALUE=\"Zaire\">Zaire</OPTION> <OPTION VALUE=\"Zambia\">Zambia</OPTION> <OPTION VALUE=\"Zimbabwe\">Zimbabwe</OPTION> </SELECT> The reason I am not using a DB for the countries is b/c I found a country list and just modified it to suit my needs. All I need to do is pull the values and print em out so I can put them in an array
-
I dont understand what you are after here. Why would you need regex to pull out Canada ? Are they stored in the database this way ? The countries list is not stored in a database at all. I include it.. include("country_list.php"); I want to write a script to automate pulling all of the countries out so I dont have to copy n paste 300 countries one by one.. //Edit: Don't know why the gender thing wasnt working at first it is now.
-
It prints both the Boy and Girl options, but should check whichever they are.
-
ah, I wasn't clear enough, My apologies. My select list is already made. I think i'm going to have to pull all the names out of the list though and put them either in an array or database though. The country they are from is in the database, so I will just have to dynamically create the select list. I got ya, thanks //Edit Considering I am terrible with regex, any suggestions to get me started pulling them out? If each was set like this <OPTION VALUE=\"Canada\">Canada</OPTION> How would I pull out canada? (granted all of the countries change as the list progresses) But on another note, if($x[gender] == "Male"){ //They are male print "<img src=\"images/boy.gif\" alt=\"Dude\" width=10 height=10 border=0><input type=\"radio\" name=\"gender\" Value=\"Male\" checked> I'm a Dude<br> <img src=\"images/girl.gif\" alt=\"Woman\" width=10 height=10 border=0><input type=\"radio\" name=\"gender\" Value=\"Female\"> I'm a Girl"; } else { //They are female print "<img src=\"images/boy.gif\" alt=\"Dude\" width=13 height=13 border=0> <input type=\"radio\" name=\"gender\" Value=\"Male\"> I'm a Dude<br> <img src=\"images/girl.gif\" alt=\"Woman\" width=13 height=13 border=0> <input type=\"radio\" name=\"gender\" Value=\"Female\" checked> I'm a Girl"; } $x[gender] prints Female, however, it still selects Male -- any ideas?
-
Ok, the title may be a bit misleading, but I dont know how else to phrase it. Here is my problem: I have a <select> list with all the countries. ex: <SELECT NAME=\"location\" id=\"country_id\" SIZE=\"1\"> <OPTION VALUE=\"1\"> Choose One </OPTION> <OPTION VALUE=\"United Kingdom\">United Kingdom</OPTION> <OPTION VALUE=\"United States\">United States</OPTION> <OPTION VALUE=\"Australia\">Australia</OPTION> <OPTION VALUE=\"New Zealand\">New Zealand</OPTION> <OPTION VALUE=\"Canada\">Canada</OPTION> Ok, so.. on the registration form, this is fine.. however, when I want to pull the info on the account update page i want it to auto choose the one that they have. Since I am not pulling this info from a database I dont know how to do it.. if i was dynamically creating the list from a db i could just loop it and select it. I hope this makes sense..
-
Cycle through an array sending emails
imperialized replied to imperialized's topic in PHP Coding Help
I see my problem, thanks for the replies.. It replaces the vars with the orig msg on the first loop but after that there is nothing to replace as the wildcards are already replaced with names.. will fix this later. After a couple hours I start to miss the little things. Thanks -
Cycle through an array sending emails
imperialized replied to imperialized's topic in PHP Coding Help
I need the $msg to change with each pass to make each email customized with the name that is on hte account $query = mysql_query("SELECT * FROM poker_users WHERE email='$email' LIMIT 1"); while($x = mysql_fetch_array($query)){ $fname = $x['fname']; $lname = $x['lname']; $poker_name = $x['poker_name']; $msg = str_replace("%fname%", $fname, $msg); $msg = str_replace("%lname%", $lname, $msg); $msg = str_replace("%pname%", $poker_name, $msg); that's why I put the query inside the foreach loop.. not sure why it doesnt change