Hi, What changes have you made in mootools-core.js (post # 28) - so my webpage working now as a browser independent webpage, please? Thank you.
Hi, What changes have you made in mootools-core.js (post # 28) - so my webpage working now as a browser independent webpage, please? Thank you.
I see you're using the link. That's not the best idea because not everyone has an email client (required for an email link).
But the main reason I'm responding is that I see that the forum converted some of my entities back to the actual characters and that I somehow left out the r in raihans (or the forum ate it) in both of my examples. I took care of all that by editing my above post. You should recopy whichever one you're currently using.
As for database work, ask in the 'PHP' or probably better, the 'MySQL and other databases' forum here. I don't know very much about databases - yet.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Oh, and while I was typing that, I see you asked about MooTools. I added 2:
blocks:Code:try{}catch(e){}
for:Code:append: function(original){ for (var i = 1, l = arguments.length; i < l; i++){ var extended = arguments[i] || {}; for (var key in extended) try{original[key] = extended[key];}catch(e){}//try/catch added for IE8 - jds } return original; }
and:Code:append: function(original){ for (var i = 1, l = arguments.length; i < l; i++){ var extended = arguments[i] || {}; for (var key in extended) original[key] = extended[key]; } return original; }
for:Code:render: function(element, property, value, unit){ try{element.setStyle(property, this.serve(value, unit));}catch(e){}//add try/catch for IE 8 - jds },
That's all from the uncompressed version. I then found the corresponding spots in the compressed version and changed them. All try{}catch(e){} does here is allow the browser to keep going if there's an error. Since (at least in this case) other browsers don't throw an error on those, and IE 8 works OK when it skips the errors it gets from those, it all works out fine.Code:render: function(element, property, value, unit){ element.setStyle(property, this.serve(value, unit)); },
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Thanks a lot for your reply.
I have recently added chat option into my site (raihans.co.uk). I have used a third party chat component, named freichat, which is free to use. But in a corner it shows 'Powered by Codologic' - not seems very professional. I couldn't find any way remove it. Also could not move the 'chat room' tab anywhere else - for which, in some browser doesn't shows my slogan. Can you please, help me on this. Or if you know any other way to have chat options, please guide me.
Thanking you again.
Raihan
That's what's known as "third party". A program that you add as an interface between you and your users. Many of these types of programs have service marks or copyrights like the 'Powered by' one you mention. Usually these are required as part of the usage terms of a free program. In these forums we are not allowed to help you avoid the usage terms of a third party program. Often it's also illegal to do so. It might not look professional. But free programs are often like that. It's called 'creditware'. Dynamic Drive scripts are like that, except that the credit only needs to be in the source code of the page. Iif you don't want the credit, often you can pay a fee to get the professional version, which usually has additional features, including the removal of the 'Powered by' credit. These additional features are often extensive though, giving you more control over how the program operates.
If nothing like that is available for the chat program you're using, there are other chat programs. But since it's (chat programs) not something I'm very interested in, I'm not aware of the choices out there. Google:
chat programs
and you can probably find a lot of options.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Hi jscheuer1,
Thanks a lot for your help in those days, came back to you again with a problem.
Please log in to my site: raihans.co.uk with 'dbuser', 'passwd'. Then hover to 'User Log In/Out' and click on 'DB Test'.
I wish to make just as the sample at the top. I have done the query and fetch in the first combo. The I have got the value in a variable as I clicked on a value in first combo, with a script. But I can't have the value in that variable to php again for another query. Can't find, how to do that, please help me. Here is what I did so far:
Thanking you again.Code:<script> function run() { var str = document.getElementById("Combo1").value; document.getElementById("text1").value = str; } </script> <form name="testForm" id="testForm" method="POST" > <select name="Combo1" id="Combo1" onchange="run()"> <option value="" selected>Select a country</option> <?php $link = mysql_connect("Domain_Name","DB_User","DB_User_passwd"); if (!$link) { die('Could not connect to Database: ' . mysql_error()); } mysql_select_db("DB_Name",$link); $category = "SELECT Country_Name FROM Test_Country"; $query_result = mysql_query($category); while($result = mysql_fetch_assoc($query_result)) { ?> <option value = "<?php echo $result['Country_Name']?>"><?php echo $result['Country_Name']?></option> <?php } ?> </select> <select name="Combo2" id="Combo2"> <option selected>Select a State</option> <?php $CName=$_GET['str']; $category = "SELECT State_Name FROM Test_State LEFT JOIN Test_Country USING (CountryID) WHERE Country_Name='$CName'"; $query_result = mysql_query($category); while($result = mysql_fetch_assoc($query_result)) { ?> <option value = "<?php echo $result['State_Name']?>"><?php echo $result['State_Name']?></option> <?php } ?> </select> TextBox1: <input type="text" id="text1" placeholder="get value on option select"><br>
Raihan
Last edited by jscheuer1; 05-01-2013 at 12:47 PM. Reason: Format
You would need to use AJAX. I see you have jQuery on the page, so something like:
Now, I'm not sure what to put on getstates.php, but it would be something like:Code:<script> function run() { var str = document.getElementById("Combo1").value; document.getElementById("text1").value = str;(function($){ $.ajax({ url: getstates.php, data: 'country=' + str, method: 'post', success: function(result){ $('#combo2').empty().append(result); } }); })(jQuery);} </script>
PHP Code:<option selected>Select a State</option>
<?php
$CName=isset($_POST['country'])? $_POST['country'] : '';
if(!$CName){die();}
$category = "SELECT State_Name FROM Test_State LEFT JOIN Test_Country USING (CountryID) WHERE Country_Name='$CName'";
$query_result = mysql_query($category);
while($result = mysql_fetch_assoc($query_result)) { ?>
<option value = "<?php echo $result['State_Name']; ?>"><?php echo $result['State_Name']; ?></option>
<?php
}
?>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
raihan (05-02-2013)
Hi, Thanks a lot for your reply. Sorry, I don't know anything about ajax. But I have tried like below:
<script>
function run() {
var str = document.getElementById("Combo1").value;
document.getElementById("Text1").value = str;
(function($){
$.ajax({
url: 'http://raihans.co.uk/source/Combo2Conct.php',
data: 'country=' + str,
method: 'post',
success: function(result){
$('#Combo2').empty().append(result);
}
});
})(jQuery); }
</script>
<form name="testForm" id="testForm" method="POST" >
<select name="Combo1" id="Combo1" onchange="run()">
<option value="" selected>Select a country</option>
<?php $link = mysql_connect("domain_name","DB_User","DB_User_pwd");
if (!$link) { die('Could not connect to Database: ' . mysql_error());
}
mysql_select_db("DB_Name",$link);
$category = "SELECT Country_Name FROM Test_Country";
$query_result = mysql_query($category);
while($result = mysql_fetch_assoc($query_result)) { ?>
<option value = "<?php echo $result['Country_Name']?>"><?php echo $result['Country_Name']?></option>
<?php
} ?>
</select>
TextBox1: <input type="text" id="Text1" placeholder="get value on option select"><br>
</form>
Then in my 'http:raihans.co.uk/source/Combo2Conct.php' file I have included:
<option selected>Select a State</option>
<?php
$CName=isset($_POST['Country_Name'])? $_POST['Country_Name'] : '';
if(!$CName){die();}
$category = "SELECT State_Name FROM Test_State LEFT JOIN Test_Country USING (CountryID) WHERE Country_Name='$CName'";
$query_result = mysql_query($category);
while($result = mysql_fetch_assoc($query_result)) { ?>
<option value = "<?php echo $result['State_Name']; ?>"><?php echo $result['State_Name']; ?></option>
<?php
}
?>
It's not working. Is there any chance to go step-by-step, as you did for me before. I am struggling with this for a long time. In the mean time I could also learn the basics of Ajax. Off-course, if you have enough time to allow me, please.
Thanks a lot again.
Raihan
Last edited by raihan; 05-02-2013 at 06:40 PM.
If you're going to look for:
on raihans.co.uk/source/Combo2Conct.php, then you need to send it from the AJAX call:$_POST['Country_Name']
The browser cache may need to be cleared and/or the page refreshed to see changes.Code:function run() { var str = document.getElementById("Combo1").value; document.getElementById("Text1").value = str; (function($){ $.ajax({ url: 'http://raihans.co.uk/source/Combo2Conct.php',data: 'Country_Name=' + str,method: 'post', success: function(result){ $('#Combo2').empty().append(result); } }); })(jQuery); }
If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
One thing we have to make sure of though is that if you post a Country_Name to raihans.co.uk/source/Combo2Conct.php, does it output the states? I just tried with a simple form:
Using spain as the country and all I got back was the initial option, the one hard coded on the raihans.co.uk/source/Combo2Conct.php page:HTML Code:<form method="post" action="http://raihans.co.uk/source/Combo2Conct.php"> <input type="text" name="Country_Name"> </form>
That part is just basic PHP and database work. If the database isn't responding with the states, there's no amount of javascript code that's going to fix that.HTML Code:<option selected>Select a State</option>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
raihan (05-03-2013)
I did like:
and in my Combo2Conct.php:Code:<script> function run() { var str = document.getElementById("Combo1").value; document.getElementById("Text1").value = str; (function($){ $.ajax({ url: 'http://raihans.co.uk/source/Combo2Conct.php', data: 'Country_Name=' + str, method: 'post', success: function(result){ $('#Combo2').empty().append(result); } }); })(jQuery); } </script> <form method="post" action="http://raihans.co.uk/source/Combo2Conct.php"> <select name="Combo1" id="Combo1" onchange="run()"> <option value="" selected>Select a country</option> <?php $link = mysql_connect("Domain_Name","DB_User","DB_User_pwd"); if (!$link) { die('Could not connect to Database: ' . mysql_error()); } mysql_select_db("DB_Name",$link); $category = "SELECT Country_Name FROM Test_Country"; $query_result = mysql_query($category); while($result = mysql_fetch_assoc($query_result)) { ?> <option value = "<?php echo $result['Country_Name']?>"><?php echo $result['Country_Name']?></option> <?php } ?> </select> TextBox1: <input type="text" id="Text1" placeholder="get value on option select"><br> </form>
It's not working. I think it cannot access the 'Combo2Conct.php' file. Otherwise it should at least suppose to show the 2nd Combo, as at the beginning I have: <select name="Combo2" id="Combo2">. Don't know, why. Please reply me, what may be my fault here.PHP Code:<select name="Combo2" id="Combo2">
<option value="" selected>Select a State</option>
<?php
$CName=isset($_POST['Country_Name'])? $_POST['Country_Name'] : '';
if(!$CName){die();}
<?php $link = mysql_connect("Domain_Name","DB_User","DB_User_pwd");
if (!$link) { die('Could not connect to Database: ' . mysql_error());
}
mysql_select_db("DB_Name",$link);
$category = "SELECT State_Name FROM Test_State LEFT JOIN Test_Country USING (CountryID) WHERE Country_Name='$CName'";
$query_result = mysql_query($category);
while($result = mysql_fetch_assoc($query_result)) { ?>
<option value = "<?php echo $result['State_Name']; ?>"><?php echo $result['State_Name']; ?></option>
<?php
}
?>
I did tried with the name 'Spain', in seperate query and it's working. So I think the query portion is alright. Problems I believe somewhere in coding and file accessing. But, can't find.
Thanks a lot again.
Raihan
Last edited by jscheuer1; 05-04-2013 at 01:35 AM. Reason: Format
Bookmarks