| | |
help me on how to change this code
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 39
Reputation:
Solved Threads: 0
hello to all;
I'am newbie to PHP and needed to all php master,
Please help me to make this code funtionally working,
her is my code that i mean to
<form id="myProvince" method="get" action="index.php">
<select name="select" style="width:200px" onchange="myProvince()">
<option value="all">Province</option>
<?php
$ByProvinceToShow=province::getByProvince($select);
if (!isError($ByProvinceToShow)) {
foreach ($ByProvinceToShow as $element => $value) {
$GetbyProvince=province::getForProvince($province);
echo '<option value="<ahref="index.php?menu=province&province='.$value->Province_id.'&select='.$value->Province_index.'">[/url]';
echo ' selected="selected"';
echo '>'.$value->Province_name.'</option>';
}
}
?>
</select>
<input type="hidden" name="menu" value="province"></input>
I'am newbie to PHP and needed to all php master,
Please help me to make this code funtionally working,
her is my code that i mean to
<form id="myProvince" method="get" action="index.php">
<select name="select" style="width:200px" onchange="myProvince()">
<option value="all">Province</option>
<?php
$ByProvinceToShow=province::getByProvince($select);
if (!isError($ByProvinceToShow)) {
foreach ($ByProvinceToShow as $element => $value) {
$GetbyProvince=province::getForProvince($province);
echo '<option value="<ahref="index.php?menu=province&province='.$value->Province_id.'&select='.$value->Province_index.'">[/url]';
echo ' selected="selected"';
echo '>'.$value->Province_name.'</option>';
}
}
?>
</select>
<input type="hidden" name="menu" value="province"></input>
Please use the code tags to put code on here.
From the information you provided it would not be possible to tell you what the issue is:
1. You have not said what is and what is not working
2. In the code you have posted you are using objects/variables which are not defined or described
In order to help we would need to know what the script is supposed to do and be able to see the classes and procedures used to populate the variables mentioned above.
From the information you provided it would not be possible to tell you what the issue is:
1. You have not said what is and what is not working
2. In the code you have posted you are using objects/variables which are not defined or described
In order to help we would need to know what the script is supposed to do and be able to see the classes and procedures used to populate the variables mentioned above.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
•
•
Join Date: Jul 2008
Posts: 39
Reputation:
Solved Threads: 0
•
•
•
•
thanks you, I create three dropdown list for region, province and by cities, the first dropdown list is used for the region, if i select from the region the second selector will display the list of province according to region and at desame time my cities list selector will also change according to province i select too. probably i done it well but, the problem i could not get the value to display on selected list.
here are the part of my code.
<?php
switch($select) {
case "city": {
if ($select!=all) {
$city=$select;
$select="city";
}
else
$city=$select;
$heading="Hotels for \"".city::getDisplayName($city)."\"";
$hotelsToShow=hotel::getForCity($city);
break;
}
case "region": {
if ($select!=all) {
$region=$select;
$select="region";
}
else
$region=$select;
break;
$heading="Hotels for \"".city::getDisplayName($region)."\"";
$hotelsToShow=hotel::getForRegion($region);
break;
}
case "province": {
if ($select!=all) {
$province=$select;
$select="province";
}
else
$province=$select;
break;
$heading="Hotels for \"".city::getDisplayName($select)."\"";
$hotelsToShow=hotel::getForProvince($select);
break;
}
case "all": {
$heading="";
$hotelsToShow=hotel::getAll();
break;
}
}
?>
<script type="text/javascript">
<!--
function formS() {
var form1;
form1=document.getElementById("myForm");
form1.submit();
}
function myRegion() {
var form1;
form1=document.getElementById("myRegion");
form1.submit();
}
function myProvince() {
var form1;
form1=document.getElementById("myProvince");
form1.submit();
}
// -->
</script>
<h2> Overview of hotels in Mindanao</h2>
Please send additional information or corrections to <a href="mailto:info@mindanao-hotels.com">Mindanao Hotels</a>
<p> </p>
<form id="myRegion" method="get" action="index.php">
<p>
<select name="select" style="width:200px" onchange="myRegion()">
<option value="all">Region</option>
<?php
$ForRegion=region::getAllRegion();
if (!isError($ForRegion)){
foreach ($ForRegion as $element => $value) {
echo '<option value="'.$value->Region_id.'"';
if ($value->Region_id==@$region)
echo ' selected="selected"';
echo '>'.$value->displayName.'</option>';
}
}
?>
</select>
<input type="hidden" name="menu" value="region"></input>
</p>
</form>
<form id="myProvince" method="get" action="index.php">
<p>
<select name="select" style="width:200px" onchange="myProvince()">
<option value="all">Province</option>
<?php
$ForProvince=province::getProvinceById($region);
if (!isError($ForProvince)){
foreach ($ForProvince as $element => $value) {
echo '<option value="'.$value->Province_id.'"';
if ($value->Province_id==@$province)
echo ' selected="selected"';
echo '>'.$value->displayName.'</option>';
}
}
?>
</select>
<input type="hidden" name="menu" value="province"></input>
</p>
</form>
<form id="myForm" method="get" action="index.php">
<p>
<select name="select" style="width:200px" onchange="formS()">
<option value="all">All cities</option>
<?php
$cities=city::getCitiesById($region);
if (!isError($cities)){
foreach ($cities as $element => $value) {
echo '<option value="'.$value->City_id.'"';
if ($value->City_id==@$city)
echo ' selected="selected"';
echo '>'.$value->displayName.'</option>';
}
}
?>
</select>
<input type="hidden" name="menu" value="city"></input>
</p>
</form>![]() |
Similar Threads
- Error 'not all code paths return a value' (C#)
- Do you listen to music while you code/design/work? (Geeks' Lounge)
- Need help with one line of code :( (C++)
- how to change a word in a string? (C)
- Trouble getting code to compile (C++)
- Please some one help me in this code (C++)
- Two Build Errors involving my code. (C++)
- HELP -my Date code isnt working (ASP)
- Urgent! Change using class (C++)
Other Threads in the PHP Forum
- Previous Thread: need help with dynamic PHP
- Next Thread: ONFOCUS() event using in php?
| Thread Tools | Search this Thread |
# 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date display dissertation dynamic echo echo$_get[x]changingitintovariable... email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail memberships menu mlm multiple multipletables mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote rss script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validator variable video web xml youtube





