PHP - Moved: Region,state,cities
This topic has been moved to Miscellaneous.
http://www.phpfreaks.com/forums/index.php?topic=312305.0 Similar TutorialsI've searched but can't seem to find anything I can apply to this situation. Most of the resources are dedicated to dropdown menu's from the same table. I have two tables 'regions' and 'cities' and I am looking to create a menu that lists all the cities within a region then moves on to do the same for the rest of the regions in that state: State1 Region1 City1 City2 City3 Region2 City1 City2 City3 Region3 Etc My tables: States table: stateID, state Regions table: regionID, region, stateID Cities table: cityID, city, regionID I currently have two pages- select region, then select city... I'd like to consolidate to one step after choosing a state. I know I need a nested loop, (while?), and to count the results somehow to retrigger loop; also not sure how to handle two mySQL querries in the nested loop. I'm having trouble wrapping my mind around it. Thank you. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=316681.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=345840.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=306496.0 Hi, I have a requirement of making the single website for different locations, customer running a enterprise, and he wants me to show corresponding items for corresponding locations(nearly around 30 locations) I am very confused how to make this(making separate sub domains for separate location), pls help me regarding this. Thanks, I've been developing an application for some time now. It's come to the point to populate the database with accurate information. I've been searching for a list of City, State, Zip, Long & Lat for each. How can I find something like this? I see tons of them for sale, 79 bucks or so, but I don't want to pay. How do most of these people get their data? Thank you hey guys
Doing last bit of site now and after doing full testing I found 1 little bug that I don't like I created an appointment section with a table to display resuilts from mysql, works great, but add more than 1 appiontment and its almost adding a whole new page See attachment for pic Heres the code for the table <?php echo '<h2>Customer Appointments</h2>'; ?> </span></div><table width="1248" border="3" align="center"> <tr class="new"> <td width="116" class="re" style="text-align: center"><strong>Date Booked</strong></td> <td width="96" class="re" style="text-align: center"><strong class="table">Time Booked</strong></td> <td width="823" class="re" style="text-align: center"><strong class="table">Notes</strong></td> </tr> <?php do { ?> <tr class="table"> <td class="re" style="text-align: center; color: #FFF;"><?php echo $row['datebooked']; ?></td> <td class="re" style="text-align: center"><?php echo $row['timebooked']; ?></td> <td class="re" style="text-align: center"><?php echo $row['notes']; ?></td> </tr> <?php } while ($row = mysql_fetch_assoc($Recordset1)); ?> </table> <span class="re"> <?phpIs there anyway I can make the Titles: Date Booked, Time Booked, Notes and have all results showing directly underneath? Attached Files success.JPG 31.29KB 0 downloads Not too familiar with sessions but I was curious to get others' input on this situation. I want to have users visit my site and be confronted with selecting their region, which will filter out the content they see. What type of sessions lifetime should I be working with here? I was thinking of keeping the session registered for as long as they stay on the site and maybe an hour afterwards just incase they visit again.
Hello everyone,
1 <?php
7 // Create connection
10 // Check connection
14 $firstname = $conn->real_escape_string($_REQUEST['firstname']); 25 $sql2 = "INSERT INTO countries VALUES ('$country')"; 27 $sql3 = "INSERT INTO Contacts (firstname, lastname, address, city, country, phone, email) VALUES ('$firstname', '$lastname', '$address', $city, $country, '$phone_number','$email')";
29 SELECT * FROM cities;
if($conn->query($sql2) === true){
if($conn->query($sql3) === true){ I am using Dreamweaver CS4 to build a website. On my contact page, I made a form with spry validation. I used a tutvid tutorial to learn a simple form handler script (I'm a complete newb at PHP) and everything works great. The only problem I'm having is, in my Dreamweaver template, I have an editable region that has the form. When the user clicks to submit the form, a new html page opens up that looks nothing like my website. What I'm trying to accomplish is having the form disappear and be replaced in the same editable region with my "thank you" message. This way, the user just submits, the form disappears, and they get a thank you message on the same page, in the same place where the form was. Here is the form code: Code: [Select] <form id="frmContact" name="frmContact" method="post" action="contact_form.php"> <fieldset><legend>Submit a question or comment...</legend> <p> <label for="name">Name:</label> <span id="spryName"> <input type="text" name="name" id="name" /> <span class="textfieldRequiredMsg">Name is required.</span><span class="textfieldMinCharsMsg">Must have at least 3 characters.</span><span class="textfieldMaxCharsMsg">Must not exceed 20 characters.</span></span></p> <p> <label for="email">Email:</label> <span id="spryPassword"> <input type="text" name="email" id="email" tabindex="10" /> <span class="textfieldRequiredMsg">Email address is required.</span><span class="textfieldInvalidFormatMsg">Not a valid email address.</span><span class="textfieldMinCharsMsg">Not a valid email address.</span><span class="textfieldMaxCharsMsg">Not a valid email address.</span></span></p> <p> <label id="message" for="question">Please tell us how we can help you:</label><br /> <span id="spryText"> <textarea name="question" id="question" cols="45" rows="5" tabindex="20"></textarea><br /> <span class="textareaRequiredMsg">A question or comment is required.</span><span class="textareaMinCharsMsg">Must have 16 characters minimum</span><span class="textareaMaxCharsMsg">Must not exceed 500 characters.</span></span></p> <p> <input type="submit" name="submit" id="submit" value="Submit" tabindex="30" /> </p> </fieldset> </form> Here is the PHP script: <?php /* Subject and Email variables */ $emailSubject = 'Contact Form Response'; $webMaster = 'centerline.computers@gmail.com'; /* Gather Data variables */ $nameField = $_POST['name']; $emailField = $_POST['email']; $questionField = $_POST['question']; $body = <<<EOD <br><hr><br> Name: $nameField <br> Email: $emailField <br> Message: $questionField <br> EOD; $headers = "From: $emailField\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html><body> <h2>Thank you for submitting.</h2> <p>We will get back to you as soon as possible.</p> </body> </html> EOD; echo "$theResults"; ?> Thanks for any help you might have for me! I am trying to create a order history page. I want it to look something like this: Ordernumber: 12 Products: Product 1 Product 2 Product 3 Product 4 Total: xx Ordernumber: 13 Products: Product 5 Product 6 Total: xx and so on. I have a recordset which get the ordernumbers from my database and i have another recordset which get the products (this recordset has a WHERE clause which is used to get the products associated with its ordernumber. Code: [Select] mysql_select_db($database_lol, $lol); $query_ono = "SELECT DISTINCT ordre.ono FROM ordre WHERE ordre.bruker='{$_SESSION['MM_Username']}'"; $ono = mysql_query($query_ono, $lol) or die(mysql_error()); $row_ono = mysql_fetch_assoc($ono); $totalRows_ono = mysql_num_rows($ono); mysql_select_db($database_lol, $lol); $query_history = "SELECT ordre.vare FROM ordre WHERE ordre.ono='{$row_ono['ono']}'"; $history = mysql_query($query_history, $lol) or die(mysql_error()); $row_history = mysql_fetch_assoc($history); $totalRows_history = mysql_num_rows($history); This is the recordsets. this is my table: +-------+---------------------+------+ | ID | vare | ono | +-------+---------------------+------+ | 1 | Product 1 | 12 | | 2 | Product 2 | 12 | | 3 | Product 3 | 12 | | 4 | Product 4 | 12 | | 5 | Product 5 | 13 | | 6 | Product 6 | 13 | +-------+---------------------+------+ So my question is: How do i do this? list all the records i mean. Thanks I added <?php $_menu = ''?> <?php foreach ($this->getStoreCategories() as $_category): ?> <?php $_menu .= $this->drawItem($_category) ?> <?php endforeach ?> <?php if ($_menu): ?> <div class="nav-container"> <ul id="nav"> <li class="level0 first nav-home"><a href="<?php echo $this->getUrl() ?>"><span><?php echo $this->__('Home') ?></span></a></li> <?php echo $_menu; ?> <li class="level0 nav-1 parent"><a href="<?php echo $this->getUrl('contacts')?>"><span><?php echo $this->__('Contact') ?></span></a></li> <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('menu')->toHtml() ?> </ul> </div> <?php endif; ?> to top.phtml and it works as expected, I now have CMS links in my nav but how can I make them have active state like the category links do?? here is the site: http://pro-tools-training.com/new-magento/index.php/video-1.html Hi I'm hoping someone can point me in the right direction. I'm trying to create a single page that contains a couple of checkboxes. When the first checkbox is checked I want to set a session. When the second chechbox is checked I want to set a different session. When the page submits ( to itself ) I'd like the checkboxes to reflect if they are checked or not. I can sort of do that part,but I'm having major issues with unsetting the sessions and updating the checkboxes to reflect this. Does anyone have a simple example on how to do this. Many Thanks Is there a way, and if so how would I detect the state of the user on my site. Like by using their ip? Thanks! I have a class (P3TElement) that extends the DOMElement class in PHP. In there i have a public variable "attributes" which is an array, and an method named add_attribute($attr), the argument is a different class (P3TAttribute). However I am getting an error when trying to use it. The exact error is: Warning: P3TElement::add_attribute() [p3telement.add-attribute]: Invalid State Error in D:\www\p3textract\extract.php on line 110 Please see the code: http://pastebin.com/CbsM9V5W This class is supposed to extract .p3t (ps3 themes) files, and is a direct port of the python equivalent found at http://p3textractor.googlecode.com/svn/trunk/p3textractor.py Could you please help me fix this? thanks in advance, Hosh Basically, I am creating a list of all the regions in the world, and I want it to display the countries that are inside each region. I am saving the data in a table that is composed of 2 columns, region name and country name. I have to do it this way, because there are some countries that fall into several regions. The link is here http://128.123.242.201/countries.php. As you can see it is repeating regions (as it should) but I don't know how to combine all the countries in each region together, and only display each geographical region once. Code: [Select] <!DOCTYPE html> <?php require "connect.php";?> <html> <head> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script> $(document).ready(function() { $("#accordion").accordion(); }); </script> </head> <body style="font-size:75%;"> <?php if(isset($_POST['submit'])) { $region = $_POST['region']; $country = $_POST['country']; $query= "INSERT INTO regions (region,country) VALUES ('$region','$country')"; $result = mysql_query($query); if(!$result) { $confirmMsg = "There was a problem updating the record."; } elseif(mysql_affected_rows()==0) { $confirmMsg = "There was no record to update."; } else { $confirmMsg = "The record was successfully updated."; } echo $confirmMsg; } ?> <h3> S<br />Add information: <form method="post" action =""><br /> Country: <input type = "text" name="country" /> Region: <input type = "text" name="region" /> <br /> <input type = "submit" value = "submit" name="submit" /> </form> </h3> <div id="accordion"> <?php //Delcare variable $info $region = $country = NULL; $query = "SELECT * FROM regions"; $result = (mysql_query($query)); while ($row=mysql_fetch_assoc($result)) { $region = "{$row['region']}"; $country = "{$row['country']}"; $deleteimg = "http://www.veryicon.com/icon/png/System/Float/Delete.png"; $delete = "<a href=\"delete.php?region=".$region."&country=".$country."\"onclick=\""; $delete .= "return confirm('Are you sure you want to delete?')\">"; $delete .= "<img src=".$deleteimg." height=\"20\"/></a>"; $accord = "<h3><a href=\"#\">$region</a></h3>"; $accord .= "<div>"; $accord .= "<p>"; $accord .= $delete.$country; $accord .= "</p>"; $accord .= "</div>"; echo $accord; } ?> </div> </body> </html> Any help on this would been very much appreciated. I am trying find a way to save the state of the JQuery accordions on my webpage after a user refreshes or changes webpages within my website. I have tried installing different scripts and downloading different cookie plugins but they either don't work or breaks all of the jquery functions on my webpage. Thank you.
This is in my header
<head> <link rel="stylesheet" type="text/css" href="css/styles.css"> <link rel="stylesheet" type="text/css" href="css/jquery-ui.css"> <script src="js/jquery.js"></script> <script src="js/jquery-ui.js"></script> <script type="text/javascript" src="Cookies/jquery.cookie.js"></script> </head>My Html <div id="History"> <!---Images---> <p>Today In History</p> <div> <script type="text/javascript" src="http://rss.brainyhistory.com/link/historyevents.js"></script><small><i>more <a href="http://www.brainyhistory.com/" target="_blank">History</a></i></small> </div> </div>This is my original JQuery code $( "#History" ).accordion({ collapsible: "true", heightStyle: "content" }); In this report I want to create a line break and a Total line for each State.
while ($row = odbc_fetch_array($result)) { echo "<tr><td>" . $row['cmlstate']."</td>"; echo "<td>" . $row['cmlpostcode']."</td>"; echo "<td>" . $row['cmlcity']."</td>"; echo "<td>" . $row['ompSalesOrderID']."</td>"; echo "<td>" . $row['cmoName']."</td>"; echo "<td>" . number_format($row['UOMPVOLUMETOTAL'],2)."</td>"; echo "<td>" . number_format($row['UOMPTOTALBOXCOUNT'],0)."</td>"; echo "<td>" . $row['Hold']."</td></tr>"; I want to sum 'UOMPVOLUMETOTAL' for each state and create a line break between it and the next state. }
Code: [Select] <div id="nav"> <ul> <li class="item"><a href="/">Home</a>/</li> <li class="item"><a href="/one">one</a></li> <li class="item"><a href="/two>two</a></li> <li class="item"><a href="/three">three</a></li> </ul> <div> i want to add class='active' to the a tags . when the menu is the current page. namely.when i on the home page. the a label is Code: [Select] <li class="item"><a href="/" class="active">Home</a>/</li> .but the others a label are not have class="active". when i on the one page. it is is Code: [Select] <li class="item"><a href="one" class="active">one</a>/</li>.the others a label are not have class="active". I've got 2 database tables (states, stores) and I want to output all the states with a list of specific locations under each state. My 'states' table has a 'state_id' and 'state' while my 'stores' table has all the store information along with the 'state_id' to work with the 'states' table. How would I ago about formulating a loop to display all locations organized by each state, etc.? |