PHP - Dynamically Generated Data Crawlable By Google?
Hey all,
Let's say if all of the data in the site is the result of queries from the database that are output as html by php as users interact with the site. For example, there's no home.php file. Rather user clicks the link to view the page, and a php script pulls data from database and renders the page at that time. There is no javascript involved in this process. Would this page be crawlable by google? Thanks for response. Similar Tutorialswhat follows is a simplified version of what i'm attempting to do. say i have a mysql table called 'pages', that looks roughly like this: Code: [Select] id parent label 1 0 home 2 0 about 3 0 events 4 2 history 5 2 philosophy 6 3 past-events 7 3 future-events 8 6 past-event-gallery which uses the parent key as a self-referencing index. items with parent=0 don't have a parent - all other items refer to rows in the same table. so, 'about' has 2 children: 'history' and 'philosophy'. this can extend an unlimited number of levels in depth. e.g., 'past-event-gallery' has a parent of 'past-events' which has a parent of 'events'. building it out is pretty straightforward - start with all rows that have a parent of 0, then recurse... Code: [Select] select id, label from pages where parent=0 // grab the id... select id, label from pages where where parent={$id} etc. which works (for example) to build out a uri for an <a> tag's href attribute. the problem arises when trying to go backwards... i'm trying to get back the id of the row from that example uri... so if the output was 'events/past-events/past-event-gallery', i'm exploding on slashes to get the component parts, and want to walk it back to get the id of the row. if the label keys were unique, it'd be simple enough... select id from pages where label={$label} but labels might be duplicated. for example, 'past-events' might have a child called 'gallery', but it might be possible that 'about' also has a child called 'gallery', etc. it might even occur several levels deep, so i need to walk it backwards until i've determined the correct id from the component parts of the URI. my initial thought was to run from left-to-right, something like: Code: [Select] while(count($parts) > 0){ $component = array_shift($parts); $result = mysql_query("select id from pages where label='{$component}'"); // this is where i lose it... maybe create a temp table from the results and continue...? } or maybe from right-to-left... Code: [Select] while(count($parts) > 0){ $component = array_pop($parts); $result = mysql_query("select id from pages where label='{$component}'"); $row_count = mysql_num_rows($result); switch($row_count){ case 1 : // this is the only one with that label, so return the ID and be done break; case 0 : // no labels match, so return a 404 or missing item or something and be done break; default : // if there are more than 1 matching labels, figure out which one - here is where i get lost on this approach... break; } } also considered a self-returning function for the second (right-to-left) idea, but didn't get far with it. any ideas? i could be (probably am) totally off on both approaches mentioned, and there might be a much easier way to do this. i'd be happy to hear any suggestions... tyia Hi All, I have been trying validating radio buttons that were generated dynamically for 2 days now. I can validate when a group of 2 or more than 2 radio buttons are created. But I am unable to validate if a single radio button is generated. So this is where I am generating radio buttons echo "<tr>"."<td class='tablewhitebg'>"."<input type = 'radio' name= 'userid' value= '".$userid. "'></td>"."<td class='tablewhitebg'>$userid</td><td class='tablewhitebg'>$userloginid</td><td class='tablewhitebg'>$fname</td><td class='tablewhitebg'>$surname</td><td class='tablewhitebg'>$locked</td><td class='tablewhitebg'>$mailbox</td><td class='tablewhitebg'>$domainid</td><td class='tablewhitebg'>$timestamp</td><td class='tablewhitebg'>$emailaddress</td><td class='tablewhitebg'>$classofservice</td></tr>\n"; Now this code is generating radio buttons, all is good but when i want to validate it using javascript, Its not working at all <script> function validate_form(thisform) { chosen = ""; len = document.form1.userid.length for (i = 0; i <len; i++) { if (document.form1.userid.checked) { chosen = document.form1.userid.value; } } if (chosen == "") { alert("Please select a record to go ahead!!"); return false; } } </script> Helps please Hi all!
I'm new here, apologies that my 1st post will be a cry for help. I'm tearing my hair out with this one.
I've got this page that generates PDF's via TCPDF plugin http://www.kinho.com/lightbox/ whenever I view it in chrome it zooms in at 100% to the top left corner. The problem is I need the images to be large and suitable to print (7"x5" or thereabouts) and so the PDF isn't built to be viewed at 100%, it just looks too zoomed in. Every other browser respects the fit to width setting. My images are 1600px on their long side, pages are landscape. here's the create.php:https://dl.dropboxusercontent.com/u/14123055/PHP/create.php
Can anybody advise a workaround for chrome? many thanks!
badger
I am trying to use Google's map API to dynamically create new maps. For example, I would like to be able to make a replica of this page using PHP. I just don't see where in the API it allows you to add all this information, such as adding categories, details, pictures, videos, etc. I've been researching for quite a while, and can't seem to come up with something that is similar to what I'm trying to do. Here is a link I found that shows you how to create maps, but I still don't see how to add all the information that you could if you did it manually! http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#CreatingMaps It would be great if someone can point me in the right direction. Thanks! This could be PHP or MySql so putting it in PHP forum for now... I have code below (last code listed) which processes a dynamically created Form which could have anywhere from 0 to 6 fields. So I clean all fields whether they were posted or not and then I update the mySQL table. The problem with this code below is that if, say, $cextra was not posted (i.e. it wasnt on the dynamically created form), then this code would enter a blank into the table for $cextra (i.e. if there was already a value in the table for $cextra, it gets overwritten, which is bad). What is the best way to handle this? I'm thinking i have to break my SQL query into a bunch of if/else statements like this... Code: [Select] $sql = "UPDATE cluesanswers SET "; if (isset($_POST['ctext'])){ echo "ctext='$ctext',"; } else { //do nothing } and so on 5 more times.... That seems horribly hackish/inefficient. Is there a better way? Code: [Select] if (isset($_POST['hidden']) && $_POST['hidden'] == "edit") { $cimage=trim(mysql_prep($_POST['cimage'])); $ctext=trim(mysql_prep($_POST['ctext'])); $cextra=trim(mysql_prep($_POST['cextra'])); $atext=trim(mysql_prep($_POST['atext'])); $aextra=trim(mysql_prep($_POST['aextra'])); $aimage=trim(mysql_prep($_POST['aimage'])); //update the answer edits $sql = "UPDATE cluesanswers SET ctext='$ctext', cextra='$cextra', cimage='$cimage', atext='$atext', aextra='$aextra', aimage='$aimage'"; $result = mysql_query($sql, $connection); if (!$result) { die("Database query failed: " . mysql_error()); } else { } Hi guys, Im making an event booking/reservation site, I have 5 tables (Malls, Events, Booking, Reservation and Users) which are all connected and doing fine. I created a function which is this... function select_all_events_by_mall_id($mall_id) { echo "<table id='event_table'>"; echo "<th>Event Name</th>"; echo "<th>Event Location</th>"; echo "<th>Number of Cars</th>"; echo "<th>Description</th>"; echo "<th>Booked</th>"; echo "<th>Reserved</th>"; echo "<th>Reserved Until</th>"; echo "<th>Vacant</th>"; $events_set = select_all_events($mall_id); while($events = mysql_fetch_array($events_set)) { echo "<tr>"; echo "<td>" . $events['event_name'] . "</td>"; echo "<td>" . $events['event_location'] . "</td>"; echo "<td>" . $events['number_of_cars'] . "</td>"; echo "<td>" . $events['description'] . "</td>"; // Booked echo "<td>"; $booked_set = select_all_booking($events['id']); while($booked = mysql_fetch_array($booked_set)) { $user_set = select_all_user_booked($booked['users_id']); while($user = mysql_fetch_array($user_set)) { echo $user['company'] . ", " . $user['branch'] . "<br />"; } } echo "</td>"; // Reserved echo "<td>"; echo "<ol>"; $reserved_set = select_all_reservation($events['id']); while($reserved = mysql_fetch_array($reserved_set)) { if(empty($reserved['events_id'])) { echo "No Reservation's "; } else { $reserved_user = select_all_user_reserved($reserved['users_id']); while($user_set = mysql_fetch_array($reserved_user)) { echo "<li>" . $user_set['brand'] . ", " . $user_set['branch'] . "</li>"; } } } echo "</ol>"; echo "</td>"; // Expiration Date echo "<td>"; echo "<ol>"; $reserved_set = select_all_reservation($events['id']); while($reserved = mysql_fetch_array($reserved_set)) { $reserved_user = select_all_user_reserved($reserved['users_id']); while($user_set = mysql_fetch_array($reserved_user)) { $exp_date = select_all_expiration_date($user_set['id']); while($date = mysql_fetch_array($exp_date)) { echo "<li>" . $date['expiration_date'] . "</li>"; } } } echo "</ol>"; echo "</td>"; //Vacant echo "<td>"; $vacant_set = select_all_booking($events['id']); $booking_count = mysql_num_rows($vacant_set); $reserved_count = mysql_num_rows($reserved_set); $total_count = $booking_count + $reserved_count; $vacant = $events['number_of_cars'] - $total_count; if($vacant < 0) { echo "This Event is fully booked"; } else { echo $vacant; } echo"</td>"; echo "</tr>"; } echo "</table>"; } The function starts by receiving an id from picking a mall name from a select tag. It works fine, it outputs the data on the page like i want it to, but my problem is that i need a way to add a submit or any button to each generated row that will, when clicked will insert the event id and user id (who clicked it) to my booking/reservation table as a new row. I tried adding a form inside my function and saving the event id every loop but when i click the submit button i think it doesn't work (or i made a mistake).. Sorry if my coding sucks, I'm kinda new in php. Sorry if its kinda confusing my head is spinning right now from thinking this stuff the whole day.. Thanks in advance for any comments and ideas. Hi there,
I have a timetable plugin that shows booking entries.
The times are generated dynamically by the plugin.
Now I have the situation where I need to override the automatically created time that shows in a table row.
Here's the HTML code generated by the plugin:
<tr class="row_12"> <td class="tt_hours_column">00:00</td>Ist it possible to have a simple PHP script that does the following (please forgive my noobiness) ? if table row is "row_12" then insert "my own pre-defined time" Please don't hate on me, I know I have not the slightest idea about php. I'm just wondering how to solve my plugin problem and if PHP is the right way to do it. I highly appreciate any feedback from you guys Here is something i dreamt up, i know there is a way for this to work, but i'm not having any great ideas at this point. I want to be able to auto increment through the $_POST[] array data sent from a PayPal IPN. Sample return data looks like item_number1=val item_name1=val so on and so forth. The idea is: While there are $_POST item_numbers, do something with it. The loop continues until there are no more item_numbers. I don't want to use the static methods eg: explicitly defining item_number1, item_number2, ect. This is what i thought would work, but keeps failing -> the script doesn't enter the first condition: $x = 1; // set the initial item number while(isset($_POST['item_number$x'])){ $qty = $_POST['quantity$x']; while($qty > 0){ // step through each item response result, setting each item to paid $package_id = $_POST['item_number$x']; update_paid_status($transaction_id, $package_id); $qty--; } $x++; } Any Ideas? Hi all i was wondering if someone with exp in youtube api could help me out with this I have a website where i want to let people subscribe to others and first off i auth the user Code: [Select] session_start(); set_include_path('path'); require_once 'Zend/Loader.php'; // the Zend dir must be in your include_path Zend_Loader::loadClass('Zend_Gdata_YouTube'); $yt = new Zend_Gdata_YouTube(); Zend_Loader::loadClass('Zend_Gdata_AuthSub'); function getAuthSubRequestUrl() { $next = 'my site'; $scope = 'http://gdata.youtube.com'; $secure = false; $session = true; return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); } function getAuthSubHttpClient() { if (!isset($_SESSION['sessionToken']) && !isset($_GET['token']) ){ echo '<a href="' . getAuthSubRequestUrl() . '">Login!</a>'; return; } else if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) { $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']); } $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']); return $httpClient; } And that takes me to the page to auth my account, then when i go back to my website and hit the sub button that i made Code: [Select] <?php $username = $_SESSION['username']; include("connect.php"); $mysql = mysql_query("SELECT * FROM users WHERE username = '$username'"); while($row = mysql_fetch_assoc($mysql)){ ?> <table> <tr><td> <?php echo $row['channel']; ?> </td></tr> <tr><td> <form action="sub4sub.php?id=<?php echo $row['id']; ?>" method="POST"> <input type="submit" name="i" value="Sub"> </form> </td></tr></table> <?php } if (isset($_POST['i'])){ $id = $_GET['id']; $sql = mysql_query("SELECT * FROM users WHERE id= $id"); $row = mysql_fetch_assoc($sql); $ytkb = $row['channel']; // this example assumes that $yt is a fully authenticated service object getAuthSubHttpClient(); $subscriptionsFeedUrl = "http://gdata.youtube.com/feeds/api/users/default/subscriptions"; $newSubscription = $yt->newSubscriptionEntry(); $channel = $ytkb; $newSubscription->setUsername(new Zend_Gdata_YouTube_Extension_Username($channel)); // post $yt->insertEntry($newSubscription, $subscriptionsFeedUrl); } ?> So should be subscribing to the persons channel that is displayed in the table, but i get this errors Quote Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401 <HTML> <HEAD> <TITLE>User authentication required.</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>User authentication required.</H1> <H2>Error 401</H2> </BODY> </HTML> ' in /home/u292976682/public_html/Zend/library/Zend/Gdata/App.php:709 Stack trace: #0 /home/u292976682/public_html/Zend/library/Zend/Gdata.php(221): Zend_Gdata_App->performHttpRequest('POST', 'http://gdata.yo...', Array, '<atom:entry xml...', 'application/ato...', NULL) #1 /home/u292976682/public_html/Zend/library/Zend/Gdata/App.php(900): Zend_Gdata->performHttpRequest('POST', 'http://gdata.yo...', Array, '<atom:entry xml...', 'application/ato...') #2 /home/u292976682/public_html/Zend/library/Zend/Gdata/App.php(975): Zend_Gdata_App->post(Object(Zend_Gdata_YouTube_SubscriptionEntry), 'http://gdata.yo...', NULL, NULL, Array) #3 /home/u292976682/public_html/sub4sub.php(123): Zend_Gdata_App->insertEntry(Object(Zend_Gdata_YouTube_Subscrip in /home/u292976682/public_html/Zend/library/Zend/Gdata/App.php on line 709 Any help would be great thanks This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=307094.0 Hi,
I have a php script that generates a select dropdown box
<option value="1"> Bob </option>
<option value="2"> Tim </option>
<option value="3"> Sam </option>
<option value="4"> Phil </option>
I then have the following javascript to produce my google api graph:
<script type="text/javascript"> google.load('visualization', '1', {'packages':['corechart']}); google.setOnLoadCallback(drawChart); function drawChart() { var jsonData = $.ajax({ url: "test1.php", dataType:"json", async: false, }).responseText; var data = new google.visualization.DataTable(jsonData); var chart = new google.visualization.LineChart(document.getElementById('chart_div')); chart.draw(data); } </script>This then runs a php script that returns the data back in Json format. How can I pass the <option value=""> through the to the test1.php script to generate the json data based on the the value selected i.e 1, 2, 3 etc. i an new at javascript and the google api can anyone let me know how I can get this variable sent through by the google api script. and for the graph to refresh every time another option is chosen. Thanks kris i've to populate google charts with dynamic data. the data looks llike. +----+-------+---------+-------+-----------+---------+------+ | id | name | physics | maths | chemistry | biology | sst | +----+-------+---------+-------+-----------+---------+------+ | 1 | Name1 | 10 | 25 | 35 | 42 | 62 | | 2 | Name2 | 80 | 45 | 45 | 45 | 25 | | 3 | Name3 | 63 | 25 | 63 | 36 | 36 | | 4 | Name4 | 82 | 36 | 75 | 48 | 42 | | 5 | Name5 | 45 | 45 | 78 | 25 | 24 | | 6 | Name6 | 36 | 36 | 15 | 75 | 36 | | 7 | Name7 | 99 | 45 | 24 | 24 | 45 | | 8 | Name8 | 45 | 85 | 85 | 85 | 96 | +----+-------+---------+-------+-----------+---------+------+ i have to create google charts based on this such that # namewise - such that when i select a name it displays all subject marks of that particular name in a column chart #markswise - when i select a subject, it displays all the names with marks in that particular subject. conisdiering that data may be added and i've to accumulate that also, for namewise i did // chart.php <?php include("connection.php"); $query = "SELECT name FROM csv GROUP BY name DESC"; $statement = $connect->prepare($query); $statement->execute(); $result = $statement->fetchAll(); ?> <!DOCTYPE html> <html> <head> <title>Google charts</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> </head> <body> <br /><br /> <div class="container"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <div class="col-md-9"> <h3 class="panel-title">Student Wise Marks Data</h3> </div> <div class="col-md-3"> <select name="name" class="form-control" id="name"> <option value="">Select Student</option> <?php foreach($result as $row) { echo '<option value="'.$row["name"].'">'.$row["name"].'</option>'; } ?> </select> </div> </div> </div> <div class="panel-body"> <div id="chart_area" style="width: 1000px; height: 620px;"></div> </div> </div> </div> </body> </html> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {packages: ['corechart', 'bar']}); google.charts.setOnLoadCallback(); function load_student_data(name, title) { var temp_title = title + ' '+name+''; $.ajax({ url:"fetch.php", method:"POST", data:{name:name}, dataType:"JSON", success:function(data) { drawStudentwiseChart(data, temp_title); } }); } function drawStudentwiseChart(chart_data, chart_main_title) { var jsonData = chart_data; var data = new google.visualization.DataTable(); data.addColumn('number', 'Physics'); data.addColumn('number', 'Maths'); data.addColumn('number', 'Chemistry'); data.addColumn('number', 'Biology'); data.addColumn('number', 'SST'); $.each(jsonData, function(i, jsonData){ var Physics = jsonData.Physics; var Maths = jsonData.Maths; var Chemistry = jsonData.Chemistry; var Biology = jsonData.Biology; var SST = jsonData.SST; data.addRows([[Physics,Maths,Chemistry,Biology,SST]]); }); var options = { title:chart_main_title, hAxis: { title: "Subjects" }, vAxis: { title: 'Percentage' } }; var chart = new google.visualization.ColumnChart(document.getElementById('chart_area')); chart.draw(data, options); } </script> <script> $(document).ready(function(){ $('#name').change(function(){ var name = $(this).val(); if(name != '') { load_student_data(name, 'Student wise marks data'); } }); }); </script> and in order to fetch data // fetch.php <?php //fetch.php include('connection.php'); if(isset($_POST["name"])) { $query = " SELECT * FROM csv WHERE name = '".$_POST["name"]."' ORDER BY id ASC "; $statement = $connect->prepare($query); $statement->execute(); $result = $statement->fetchAll(); foreach($result as $row) { $output[] = array( 'Physics' => $row["Physics"], 'Maths' => $row["Maths"], 'Chemistry' => $row["Chemistry"], 'Biology' => $row["Biology"], 'SST' => $row["SST"], ); } echo json_encode($output); } ?> it diplays a blank page. however when i play with singular values i.e one subject at a time it displays fine Edited March 19, 2019 by zetastreakHi Guys.... I need to export data into excel file. So far its works on IE and Firefox. But if i using Google Chrome it download only php file. Eg(suppose file test.xls but it goes to test.php). Why it happen?? Hi People. I run the following airfield site http://www.microlight.co Now on each airfield card there is a google iframe image that is held in the database and shows OK on the page. Anyone got any idea how I can get a hold of the co-ordinate information for each card so that I can display it somewhere else on screen? Here is a typical image of the airfield I use. Code: [Select] <iframe width="700" height="700" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.google.co.uk/maps?ie=UTF8&t=h&ll=53.952058,-1.17631&spn=0.008839,0.014999&z=16&output=embed"></iframe><br /><small><a href="http://www.google.co.uk/maps?ie=UTF8&t=h&ll=53.952058,-1.17631&spn=0.008839,0.014999&z=16&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small> I'm trying to generate RSS by using PHP and MySQL but I keep getting an error message that I don't know how to solve. Here's the error message: <b>Deprecated</b>: Function mysql_db_query() is deprecated in <b>G:\xampp\htdocs\xampp\dsa\class_rss.php</b> on line <b>32 Here's line 32: Code: [Select] $result = mysql_db_query (DB_NAME, $query, LINK); Here's the entire code from the class: Code: [Select] <? // code followed from http://www.webreference.com/authoring/languages/xml/rss/custom_feeds/ // images sourced: http://www.inyourbasket.com/search/usb-flash-drives/09A?cm_mmc_o=7BBTkw*Vzbp+mwzygt*JmP+4wFByY+mfbgLl*JmP+4wFByY+mfbgL+C+7wEwybg&gclid=CKuGh8DwyKcCFYFB4QodyGRvBg class RSS { // function to include the file which holds global variables. public function RSS() { require_once ('connectvars.php'); } // function derived from both private functions. public function GetFeed() { return $this->getDetails() . $this->getItems(); } // function to connect to the database private function dbConnect() { DEFINE ('LINK', mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)); } // function to retreive data from the table, and insert between set xml tags which loops through the rows in the table. private function getDetails() { $stick = "stick,"; $location = "location,"; $identification = "identification"; $this->dbConnect($stick, $location, $identification); $query = "SELECT * FROM ". $stick . $location . $identification; $result = mysql_db_query (DB_NAME, $query, LINK); while($row = mysql_fetch_array($result)) { $details = '<?xml version="1.0" encoding="ISO-8859-1" ?> <rss version="2.0"> <channel> <title>'. $row['stick.make'] .'</title> <description>'. $row['stick.colour'] . $row['location.street'] . $row['location.town'] . $row['location.city'] .'</description> <image> <url>'. $row['identification.image_url'] .'</url> <width>'. $row['identification.image_width'] .'</width> <height>'. $row['identification.image_height'] .'</height> </image>'; } return $details; } // function to iterate through the table, retreiving data each time and outputting an end result of an RSS structured page. private function getItems() { $stick = "stick,"; $location = "location,"; $identification = "identification"; $this->dbConnect($stick, $location, $identification); $query = "SELECT * FROM ". $stick . $location . $identification; $result = mysql_db_query (DB_NAME, $query, LINK); $items = ''; while($row = mysql_fetch_array($result)) { $items .= '<item> <title>'. $row["stick.make"] .'</title> <description><![CDATA['. $row["stick.colour"] .']]></description> </item>'; } $items .= '</channel> </rss>'; return $items; } } ?> Could anyone help me out here? Thanks On a website currently under development the URL does not change when navigating around on the page. It always displays the root URL. This is the script that should generate the links: $URLvars=substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],"/")+1); $vatLink=$URLvars; $thisPageURL=$_SERVER["PHP_SELF"]; if(strpos($thisPageURL, "secure/locktech/")!==false)$thisPageURL=substr($_SERVER["PHP_SELF"], 16); $prodLink="http://www.lock-tech.co.uk".$thisPageURL; It used to. However, the server has changed and it does not any more. Is it maybe because the 2 paths (http://www.lock-tech.co.uk and secure/locktech/) must be changed according to the new server? Does anyone know what exactly do these paths stand for? I understand that one of them is the root path but what does the path in the line Code: [Select] if(strpos($thisPageURL, "secure/locktech/")!==false)$thisPageURL=substr($_SERVER["PHP_SELF"], 16); stand for? I have something like this on one of my pages: $name = 'Bob'; Code: [Select] if ((isset($_POST['name'])) || ($_POST['name'] == '')) { $name = $_POST['name']; //update database } echo '<form action='' method='POST'>'; echo '<table><tr><td width="125">Name: </td><td><input type="text" name="signature" style="width: 270px;" value="' . $name . '" /></td></tr></table>'; echo '</form>'; Here's the problem: Initially, because the form data has not been sent the input box says: 'Bob'. If I remove the name Bob from the input box by manually clicking in it and deleting the name, and I submit the form, it keeps showing 'Bob', whereas I would like it to be empty. What am I doing wrong? Hi. I have a rating site where users fill in a name of what they are rating, comments about it and a rating and submit it to my database. I then have another page which shows all of these entries but only the name and overall rating using php. What I want is for users to click on the name and it take them to a separate page which displays all the comments and ratings for that item. As users can add items to rate I cant set up a page for each manually so was wondering how to do it dynamically. Everything i throw into google leads me in the wrong direction though. If someone could point me to a good tutorial or give me an idea about what to search id be very grateful. Cheers. Hey all, I have a relationship where a zone has many posts and a category has many zones but a zone can also have many categories. The zones are basically parts of a page, such as the main area and sidepanel stored in database as records with name fields such as 'panel' and 'main'. There's a serious flaw right now and I would like to know the best solution to address it. Right now I access the posts of a zone of a category like this: Code: [Select] $category->zone->get()->post->get(); The above ends up displaying all the posts in the database for any given category because when category is selected, it searches for the associating zones, and then selects all posts related to those zones, which is wrong. i want to select all posts of the zones associated with that particular category. Current database: Code: [Select] posts id zone_id zones id name categories_zones id zone_id category_id categories id What should I do? Add a category_id column to the posts table and relate the post directly to the category as well as directly to the zones table so the post table would have two foreign keys: category_id and zone_id Would this be the most effective thing to do given my requirements? Thanks for response. |