PHP - Echo From Database To Input Text
Hi guys
I have created a profile page where users can update their profile. what I need to do is to echo back the users details in the inout text I have name and telephone number any ideas how to do it? here is my code <?php session_start(); include ("global.php"); //username session $_SESSION['username']=='$username'; $username=$_SESSION['username']; //welcome messaage echo "Welcome, " .$_SESSION['username']."!<p>"; if ($_POST['register']) { //get form data $name = addslashes(strip_tags($_POST['name'])); $telephonenumber = addslashes(strip_tags($_POST['telephonenumber'])); $query = "UPDATE users SET name = ' $name' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE users SET telephonenumber = ' $telephonenumber' WHERE username='$username'"; $result = mysql_query($query); } ?> <form action='updateprofile.php' method='POST'> Company Name:<br /> <input type='text' name='name'><p /> <input type='text' name='telephonenumber'><p /> <input type='submit' name='register' value='Register'> </form> _______ the reason i want to do this is because when user is updating the name field the empty input text for telephone number ovverides the telephone number field in the database. I would aprreciate your help guys, Similar TutorialsHello, I am attempting to create a script where a user puts a text string into a form and clicking on submit. Then it adds that text string to a mysql database and gives the user a link back to it. Something like mysite.com/key.php?id=4 and when going to that link it will display the text string from the database but printed in an image. I wrote something up but I cannot get it to work. I may be a little in over my head. Any help is appreciated.
The way I coded this all to work is the user inputs the information into index.php which givekey.php inserts that into the database. I have not yet figure out how to do this in one single step. After that I wanted it to navigate directly to key.php which would display the key and the link to that page with the ?key=XX attribute. getkey.php <?php require_once 'dbinfo.php'; // database connection $id = $_GET['id']; // do some validation here to ensure id is safe $link = mysql_connect($servername, $username, $password); if (!$link) { die('Could not connect: ' . mysql_error()); } @mysql_select_db($database) or die( "Unable to select database"); $sql = "SELECT ukey FROM keycode WHERE id=$id"; $result = mysql_query("$sql"); $row = mysql_fetch_assoc($result); mysql_close($link); header("Content-type: image/png"); echo $row['ukey']; ?> key.php <html> <head> <title>Your Key Is Ready</title> </head> <body> <img src="getkey.php?id=1" width="175" height="200" /> </body> </html>index.php <html> <head> <title></title> </head> <body> <section id="mid_section"> <div id="boxes"> <h1> Testing input key </h1> <br/> <form id="myform" action="givekey.php" method="post"> Key:<br /> <input type="text" value="ukey"> Source:<br /> <input type="radio" value="hb">HB<br /> <input type="radio" value="ig">IG<br /> <input type="radio" value="other">Other<br /> <button id="sub">Submit</button> </form> </body> </html>givekey.php <?php include_once('dbinfo.php'); $conn = mysql_connect($servername, $username, $password); $db= mysql_select_db($database); $ukey =$_POST['ukey']; $hb =$_POST['hb']; $ig =$_POST['ig']; $other =$_POST['other']; if(mysql_query("INSERT INTO `keycode`(`ukey`) VALUES ([$ukey]); INSERT INTO `source`(`hb`,`ig`,`other`) VALUES ([$hb],[$ig],[$other]);")) ?> Edited by chrisb302, 13 November 2014 - 12:18 AM. need to echo all word combinations from the input also lets say that someone types "this is my query" into an input fiend and this will be the input. i need the php script to echo all the possible combinations of this string. but there can be 4 words like in the example or 3 or more or less. also it should then echo something like this: this this is this is my this is my query is is my is my query is my query this my my query my query this my query this is query query this query this is query this is my + query is my this this my query is also all combinations possible, for 1 word, 2 words, ... max. words inputed. How can i simply put the input box at the end of echo $page_pagination; instead of dropping down to a new line. Code: [Select] echo $page_pagination; echo '<FORM NAME="Library Search" ACTION="z3950get.php" METHOD="POST">'; echo '     Or go to page number '; echo '<input type="text"SIZE="5" name="pageinput2" value="'. $page_num.'">'; echo '<input type="hidden" name="recordcount" value="'.$recordcount.'"/>'; echo '<button type="submit" name="pageinput1" value="search">Search</button>'; echo '</FORM>'; echo '<BR><BR>'; echo 'Showing Page Number -> '.$page_num. ' | Total number of results -> '.$numrows . ' | Total number of pages -> '.$numofpages.'<BR><BR>'; <a href="entries.php?eid=<?php echo $row2->eid; ?>" class="n">Entry ID <?php echo $row2->eid; ?> by <?php echo $row2->username; ?></a> My issue is that the second output of entry id works fine. The first output, being the more important, does not, even though they are identical. This will probably be something ridiculously stupid. Hi guys When I retrieve information from database into text field and update the fields, each time I press on update button, an space gets added before the text so in screenshots I have added you can see in image1 everything is fine but once I click on update, a space will be added before the text inside the text field. Here is my code <?php session_start(); include ("global.php"); //username session $_SESSION['username']=='$username'; $username=$_SESSION['username']; //welcome messaage echo "Welcome, " .$_SESSION['username']."!<p>"; if ($_POST['register']) { //get form data $name = addslashes(strip_tags($_POST['name'])); $telephonenumber = addslashes(strip_tags($_POST['telephonenumber'])); $buildingnumber = addslashes(strip_tags($_POST['buildingnumber'])); $streetname = addslashes(strip_tags($_POST['streetname'])); $town = addslashes(strip_tags($_POST['town'])); $county = addslashes(strip_tags($_POST['county'])); $country = addslashes(strip_tags($_POST['country'])); $postcode = addslashes(strip_tags($_POST['postcode'])); $email = addslashes(strip_tags($_POST['email'])); //update statements $query = "UPDATE userss SET name =' $name' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE userss SET telephonenumber = ' $telephonenumber' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE userss SET buildingnumber = ' $buildingnumber' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE userss SET streetname = ' $streetname' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE userss SET county = ' $county' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE userss SET town = ' $town' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE userss SET country = ' $country' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE userss SET postcode = ' $postcode' WHERE username='$username'"; $result = mysql_query($query); $query = "UPDATE userss SET email = ' $email' WHERE username='$username'"; $result = mysql_query($query); } //update from database to txt field $update = "SELECT name, telephonenumber, buildingnumber, streetname, country, town, postcode, county, email FROM userss WHERE username='$username'"; $result = mysql_query($update); $row = mysql_fetch_assoc($result); ?> <form action='updateprofile.php' method='POST'> Name:<br /> <input type='text' name='name' value='<?php echo $row['name'];?>'><p /> Telephone Number:<br /> <input type='text' name='telephonenumber' value='<?php echo $row['telephonenumber'];?>'><p /> Building Number:<br /> <input type='text' name='buildingnumber' value='<?php echo $row['buildingnumber'];?>'><p /> Street Name:<br /> <input type='text' name='streetname' value='<?php echo $row['streetname'];?>'><p /> County:<br /> <input type='text' name='county' value='<?php echo $row['county'];?>'><p /> Town:<br /> <input type='text' name='town' value='<?php echo $row['town'];?>'><p /> Country:<br /> <input type='text' name='country' value='<?php echo $row['country'];?>'><p /> Postcode:<br /> <input type='text' name='postcode' value='<?php echo $row['postcode'];?>'><p /> Email:<br /> <input type='text' name='email' value='<?php echo $row['email'];?>'><p /> <input type='submit' name='register' value='Update'> </form> <iframe width="750" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=<?php echo "$buildingnumber,+$streetname,+$town,+ $postcode,+$county,+$country";?>&sll=&sspn=0.007597,0.025921&ie=UTF8&hq=&hnear=<?php echo "$buildingnumber,+$streetname,+$town,+ $postcode,+$county,+$country";?>&ll=&spn=0.011236,0.025921&z=14&output=embed"></iframe> could someone kindly advice me on this please? Hi, I have a search results page that return the results based on "Make" & "Model" of vehicle. The question is, can an image be echoed onto that results page based on which make and model has been searched for? The image is stored in a field called "Image_Van" so would need to display that depending on the row in that database that has been selected from Make & Model... Hope this makes sense! <?php //info bars colour $color_info="#D6D685"; // Almost Silver //FFFFCC $color1="#E9E9E9";// Light Blue $color2="#EAD5FF";// Light Blue //include function library code include_once("func_lib.php"); // use the user_connection include file's connectDB function include_once("usr_conn.php"); if (!connectDB()) { echo "<p>Unable To Connect To Database</p>"; return; } //test that make and model are passed in, if they are assign them if (($_GET ['make'] == "MAKE") or ($_GET ['model'] == "MODEL")) { $errMessage = "<br><br><b><font class=small>Your search hasn't returned any results, please re-enter your search again.</font></b><br><br><a href=van_accessories.php>Search again</a><br><br>"; } else { // get search values for make and model, removing " and ' chars $strMake = mysql_escape_string($_GET ['make']); $strModel = mysql_escape_string($_GET ['model']); } // set the Prod_Type that is to be shown regardless of car make and model $strDefaultProd = "XD"; //write query string that will pased in paging links $strQuery = "make=".$strMake."&model=".$strModel."&"; //echo $strQuery; //grab the page number that we're on $page = mysql_escape_string($_GET ['page']); //$strMake = "FIAT"; //$strModel = "Uno"; //create sql query $sqlSelect = "SELECT Prod_ID, Prod_Type, Prod_Model, Prod_Make, Prod_REF, Product_Desc, Price_ExVat, image_name, Image_Van FROM products"; //change this back to 'FILL THIS IS IN' to switch accessories off! $criteria = " WHERE (Car_Make = '".$strMake."' AND Car_Model = '".$strModel."' AND Default_Code = 'RS') OR (Car_Make = 'all' AND Default_Code = 'SA')"; //$criteria = " WHERE Car_Make = '".$strMake."' AND Car_Model = '".$strModel."'"; // assign the basic sqlquery $sqlquery = $sqlSelect . $criteria; //echo $sqlquery; #debug //get the result set $result = mysql_query($sqlquery); $count = mysql_num_rows($result); $full_count = $count; //set max number of records per page $records_per_page = 999; //Next figure out how many pages you'll have. $total_pages = ceil( $count / $records_per_page ); /* This just sets up a page variable which will be past in a "next" and "prev" link. The first link to this page may not actually have $page so this just sets it up. */ if ( $page == "" ) { $page = 1; } //echo "<br>page number".$page; #debug # this will set up the "First | Prev | " part of our navigation. if ( $page == 1 ) { # if we are on the first page then "First" and "Prev" # should not be links. $naviagation = "<font color=\"#666666\">First</font> | <font color=\"#666666\">Prev</font> | "; } else { # we are not on page one so "First" and "Prev" can # be links $prev_page = $page - 1; $navigation = "<a href=\"van_steps_results.php?".$strQuery."page=1\">First</a> | <a href=\"van_steps_results.php?".$strQuery."page=".$prev_page."\">Prev</a> | "; } # this part will set up the rest of our navigation "Next | Last" if ( $page == $total_pages ) { # we are on the last page so "Next" and "Last" # should not be links // $navigation .= "<font color=\"#666666\">Next</font> | <font color=\"#666666\">Last</font>"; } else { # we are not on the last page so "Next" and "Last" # can be links $next_page = $page + 1; $navigation .= "<a href=\"van_steps_results.php?".$strQuery."page=".$next_page."\">Next</a> | <a href=\"van_steps_results.php?".$strQuery."page=".$total_pages."\">Last</a>"; } /* The final thing to do is your actual query, but first we have to figure out what the offset will be. */ $offset = ( $page - 1 ) * $records_per_page; //echo "<br>offset".$offset; #debug //create sql query $sqlSelect = "SELECT Car_Make, Car_Model, Prod_ID, Prod_Type, Prod_Model, Prod_Make, Priority, Prod_Code, Prod_REF, Product_Desc, Price_ExVat, Link, image_name, Image_Van FROM products"; $criteria = " WHERE (Car_Make = '".$strMake."' AND Car_Model = '".$strModel."' AND Default_Code = 'RS') OR (Car_Make = 'all' AND Car_Model = 'all' AND Default_Code = 'SA')"; $limit = " ORDER BY Priority ASC, Prod_Code ASC, Prod_ID ASC LIMIT $offset, $records_per_page"; // assign the basic sqlquery $sqlquery = $sqlSelect . $criteria . $limit ; //echo $sqlquery; //get the result set $result = mysql_query($sqlquery); // if no matches found from query if (!$result || (mysql_num_rows($result) == 0)){ //echo ("<b><font class=small>No matches were found.</font></b>"); } // display the results else{ // use rowcount to display total results found $count = mysql_num_rows($result); //echo $count; //echo("<p>Total Matches Found = " . $rowCount . "</p>"); //*debug } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Results Page:</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script> <!--script src="js/jquery.lint.js" type="text/javascript" charset="utf-8"></script--> <link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" /> <script src="js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script> <!-- start header graphic html --> <style type="text/css"> <!-- .table { border: 0px none; border-collapse: separate; } BODY { } A { COLOR: #003366; TEXT-DECORATION: none; } A:hover { TEXT-DECORATION: underline; color: #900; } .small { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; } .std { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; COLOR: #000000; } .header { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; FONT-WEIGHT: BOLD; COLOR:#000000; } .bigheader { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; FONT-WEIGHT: BOLD; COLOR:#FFFFFF; } .error { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; COLOR:#FF0000 } .headertable { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; FONT-WEIGHT: regular; COLOR:#FFFFFF; BACKGROUND-COLOR:#000066; } .stdtable { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; FONT-WEIGHT: regular; COLOR:#000066; } .style16 {font-size: 11px} .style7 { color: #CC0000; font-style: italic; } .small1 { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; } .header1 { FONT-SIZE: 8pt; FONT-FAMILY: Verdana; FONT-WEIGHT: BOLD; COLOR:#000000; } a:link { color: #900; } --> </style> <div align="center"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td background=""><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td bgcolor="#003366"> </td> </tr> </table> <!--END header--> <table width="960" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td><div align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="arial11"><table width="100%" border="0" cellpadding="10" cellspacing="0"> <tr> <td width="33%"><p><img src="2003/results.gif" alt="" width="238" height="43" /></p> <p> </p> <p> </p></td> </tr> </table></td> </tr> </table> </div></td> </tr> </table> <table width="950" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#FFFFFF"> <tr align="center" valign="top" class="std"> <td colspan="7"><hr width="500" size="1" /> <?php if (isset($errMessage)){ echo $errMessage; } // if no matches found from query if (!$result || (mysql_num_rows($result) == 0)) echo ("<b><font class=small>No matches were found.</font></b><br><br>"); // display the results else{ // use rowcount to display total results found echo("<br><p><em><font class=vehicle>Search Results for " . $strMake . " " . $strModel .".</em> Total Matches Found = " . $full_count . "</p>"); //*debug echo $navigation; } /* With your navigation built you can just echo that out any where you want it to appear. */ //echo $navigation; ?></td> </tr> <?php $title = "<tr align=\"center\" class=\"headertable\" height=\"32\">"; $title .= "<td width=\"95\"><img src=\"images/transparent.gif\" width=\"95\" height=\"1\" /></td>"; $title .= "<td width=\"60\">Make</td>"; $title .= "<td width=\"60\">Ref No.</td>"; $title .= "<td width=\"550\">Title/Description</td>"; $title .= "<td width=\"73\">Price Ex VAT</td>"; $title .= "<td width=\"73\">Price Inc VAT</td>"; $title .= "<td width=\"60\"><img src=\"2003/basket.gif\" width=\"21\" height=\"14\"></td>"; $title .= "</tr>"; //set the counters for the records results display screen $cnt = 0; $headercount1 = 0; $headercount2 = 0; $headercount3 = 0; $headercount4 = 0; $headercount5 = 0; $headercount6 = 0; $headercount7 = 0; while ($row = mysql_fetch_assoc($result)) { //cut the prod_type variable //get the length of the variable $strLength = strlen ($row["Prod_Type"]); //assign first 2 characters of variable $strPrefix = substr($row["Prod_Type"], 0, 2); //debug //echo "\n prefix :" . $strPrefix; //assign remaining characters of variable $strSuffix = substr($row["Prod_Type"], 2, $strLength); //debug //echo "\n suffix :" . $strSuffix; //set product header image depending on the Prod_Type Code //start the table row echo "<tr align=center><td colspan=7 class=small>"; //set bg cell color diff for BH make switch ($strPrefix) { case "BH": $color=$color2; break; default: $color=$color1; break; }//end switch switch ($strPrefix) { case "BH": if ($headercount1 == 0) { echo "<img border=0 src=2003/searchheaders/step.jpg></td></tr>"; echo $title; } $headercount1 ++; //$headercount1 break; // REMOVE ALL THIS COMMENTING IF NEEDED TO SHOW THE ROOF BARS! case "RB": // if ($headercount2 == 0) // { // echo "<img border=0 src=2003/searchheaders/NOTUSED.jpg alt=Roof-Bars></td></tr>"; // echo $title; // } // $headercount2 ++; //$headercount1 break; case "BX": if ($headercount3 == 0) { echo "<img border=0 src=2003/searchheaders/bulkheads.jpg alt=Roof-Boxes></td></tr>"; echo $title; } $headercount3 ++; //$headercount1 break; case "BR": if ($headercount4 == 0) { echo "<img border=0 src=2003/searchheaders/bulkheads.jpg alt=Bike-Racks></td></tr>"; echo $title; } $headercount4 ++; //$headercount1 break; case "SR": if ($headercount5 == 0) { echo "<img border=0 src=2003/searchheaders/bulkheads.jpg alt=Ski-Rack></td></tr>"; echo $title; } $headercount5 ++; //$headercount1 break; case "CR": if ($headercount6 == 0) { echo "<img border=0 src=2003/searchheaders/bulkheads.jpg alt=Canoe-Rack></td></tr>"; echo $title; } $headercount6 ++; //$headercount1 break; case "XD": if ($headercount7 == 0) { echo "<img border=0 src=2003/searchheaders/towbar.jpg alt=General-Accessories></td></tr>"; echo $title; } $headercount7 ++; } //end header image selection and close the table row. //echo "</td></tr>"; // if (($cnt++)%2) // { // $color="#E9E9E9"; // Almost Silver // } // else // { // $color="#E9E9E9";// Light Blue // } //print a product row if the prodtype isn't set to INFO $pop_link = ""; if ($strSuffix != "INFO"){ //test to see if an image exists for the product if ($row["Link"] <> NULL){ $pop_link = " <a href=\"products/".$row["Link"]."?iframe=true&width=650&height=500\" rel=\"prettyPhoto\" >More information >>>></a>"; } echo "<tr class=stdtable align=center height=25>"; //DISPLAY THUMB IMAGE IF ONE WAS LISTED IN THE image_name FIELD $p_Image_Van = htmlspecialchars($row["Image_Van"]); //echo "p_Image_Van:$p_image_name"; if ($p_Image_Van != "") echo "<td bgcolor=$color width=\"95\"><img src=\"images/product_images/$p_Image_Van\" border=\"0\" /></td>"; else echo "<td bgcolor=$color width=\"95\"><img src=\"images/transparent.gif\" width=\"95\" height=\"50\" border=\"0\" /></td>"; echo "<td bgcolor=$color width=\"60\">". htmlspecialchars($row["Prod_Make"]) . "</td><td bgcolor=$color width=\"60\">" . htmlspecialchars($row["Prod_REF"]) . "</td><td bgcolor=$color align=left class=\"infolink\" width=\"550\">" . htmlspecialchars($row["Product_Desc"]) . $pop_link . "</td><td bgcolor=$color width=\"73\">£" . number_format(htmlspecialchars($row['Price_ExVat']), 2) . "</td><td bgcolor=$color width=\"73\">£" . number_format((calcVAT (htmlspecialchars($row['Price_ExVat']))), 2) . "</td><td bgcolor=$color width=\"60\"><a href=basket.php?src=".urlencode($_SERVER['REQUEST_URI'])."&productID=" . $row["Prod_ID"] . "><img src=2003/buy.gif border=0></a></td></tr>"; } // if the prod type is set to INFO then print out a new row for that information else { echo "<tr class=stdtable align=center height=25 ><td colspan=7 bgcolor=$color_info><em><strong>" . htmlspecialchars($row["Product_Desc"]) . "</strong></em></td></tr>"; } } //****************************************************************************************************** /* //get all porducts from the database that are marked with prod_type XD regardless of car make and model $sqlSelectDefault = "SELECT Prod_ID, Prod_Type, Prod_Model, Prod_Make, Priority, Prod_Code, Prod_REF, Product_Desc, Price_ExVat FROM products"; $criteriaDefault = " WHERE Prod_Type LIKE '".$strDefaultProd."%'"; $limitDefault = "ORDER BY Priority ASC, Prod_Code ASC"; // assign the basic sqlquery $sqlqueryDefault = $sqlSelectDefault . $criteriaDefault . $limitDefault ; //echo $sqlquery; //get the result set $resultDefault = mysql_query($sqlqueryDefault); // if no matches found from query if (!$resultDefault || (mysql_num_rows($resultDefault) == 0)){ //echo ("<b><font class=small>No matches were found.</font></b>"); } // display the results else{ // use rowcount to display total results found $countDefault = mysql_num_rows($resultDefault); //echo $count; //echo("<p>Total Matches Found = " . $rowCount . "</p>"); //*debug } //set product header image depending on the Prod_Type Code //start the table row echo "<tr align=left><td colspan=6 class=small>"; echo "<img border=0 src=2003/searchheaders/general.jpg alt=General-Accessories>"; echo "</td></tr>"; while ($rowDefault = mysql_fetch_assoc($resultDefault)) { //cut the prod_type variable //get the length of the variable $strLengthDefault = strlen ($rowDefault["Prod_Type"]); //assign first 2 characters of variable $strPrefixDefault = substr($rowDefault["Prod_Type"], 0, 2); //debug //echo htmlspecialchars($rowDefault["Prod_ID"]); //echo "\n prefix :" . $strPrefixDefault; //assign remaining characters of variable $strSuffixDefault = substr($rowDefault["Prod_Type"], 2, $strLengthDefault); //debug //echo "\n suffix :" . $strSuffixDefault; if ($strSuffixDefault != "INFO"){ $color="#E9E9E9"; // Almost Silver //print a product row if the prodtype isn't set to INFO echo "<tr class=stdtable align=center height=25 ><td bgcolor=$color>". htmlspecialchars($rowDefault["Prod_Make"]) . "</td><td bgcolor=$color>" . htmlspecialchars($rowDefault["Prod_REF"]) . "</td><td bgcolor=$color align=left>" . htmlspecialchars($rowDefault["Product_Desc"]) . "</td><td bgcolor=$color>?" . number_format(htmlspecialchars($rowDefault['Price_ExVat']), 2) . "</td><td bgcolor=$color>?" . number_format((calcVAT (htmlspecialchars($rowDefault['Price_ExVat']))), 2) . "</td><td bgcolor=$color><a href=basket.php?src=".urlencode($_SERVER['REQUEST_URI'])."&productID=" . $rowDefault["Prod_ID"] . "><img src=2003/buy.gif border=0></a></td></tr>"; } // if the prod type is set to INFO then print out a new row for that information else { echo "<tr class=stdtable align=center height=25 ><td colspan=6 bgcolor=$color><em>" . htmlspecialchars($rowDefault["Product_Desc"]) . "</em></td></tr>"; } } */ ?> <tr align="center"> <td colspan="7" class="small1"></td> </tr> <tr> <!-- <tr align="center" class="headertable" height="32"> <td width="145">Product Name</td> <td width="178">Ref No.</td> <td width="280">Description</td> <td width="73">Price Ex VAT</td> <td width="73">Price Inc VAT</td> <td width="60"><img src="2003/basket.gif" width="21" height="14"> </td> </tr>--> <td colspan="7" height="1" bgcolor="#003366"><img src="colour_spacer.gif" width="756" height="1" /></td> </tr> </table></td> </tr> </table> <p><br /> </p> </p> <div align="center"><br /> </div> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> </td> </tr> </table> <?php //free up some memory mysql_free_result($result); // close the aatabase connection mysql_close(); //include footer code ?> <br /> </table> </html> Hi people, I really hope you guys can help me out today. I'm just a newbe at php and i'm having real trouble. Bassically all I want to do is have a user type in a company name in a html form. If what the user types in the form matches the company name in my php script i want the user to be sent to another page on my site. If what the user types in the form doesnt match the company name in my php script i want the user to be sent to a differnt page like an error page for example. this is my html form: Code: [Select] <form id="form1" name="form1" method="post" action="form_test.php"> <p>company name: <input type="text" name="company_name" id="company_name" /> </p> <p> <input type="submit" name="button" id="button" value="Submit" /> </p> </form> And this is the php code I'm trying to process the information on: Code: [Select] <?php $comp_name = abc; if(isset ($_POST["company_name"])){ if($_POST["company_name"] == $comp_name){ header("Location: http://www.hotmail.com"); exit(); } else{ header("Location: http://www.yahoo.com"); exit(); } } ?> The thing is i'm getting this error when i test it: Warning: Cannot modify header information - headers already sent by (output started at D:\Sites\killerphp.com\form_test.php:10) in D:\Sites\killerphp.com\form_test.php on line 17 Please can some one help me out, i'm sure this is just basic stuff but i just cant get it to work Cheers. I have peice of code which is designed enter a question into a database and the username of the person who asks the question. However, the code enters <?php echo Array; ?> into the database and not 'Tom'. I am using the same code which inserts the category of the question in the database which works. But the username comes up as <?php echo Array; ?>. Does anyone know why it shows "array"? Code: [Select] if($loggedIn) { echo "Welcome, ".$user['username'].". <a href=\"logout.php\">Logout</a>. <table width='300' border='0' align='center' cellpadding='0' cellspacing='1'> <tr> <td><form name='form1' method='post' action='phpviewquestion.php'> <table width='100%' border='0' cellspacing='1' cellpadding='3'> <tr> <td colspan='3'><strong>Your Question</strong></td> </tr> <tr> <td width='71'>Question</td> <td width='6'>:</td> <td width='600' height='50'><input name='question' type='text' id='question'></td> <td width='71'>Notes</td> <td width='6'>:</td> <td width='600' height='50'><input name='notes' type='text' id='notes'></td> </tr> <tr> <td colspan='3' align='center'><input type='image' name='image' value='Submit' src='http://www.domain.co.uk/images/submitbutton.PNG' name='image' width='100' height='53'></td> <input name='category' type='hidden' value='Furniture' id='category' > <input name='questionmaker' type='hidden' value='<?php echo $username; ?>' id='questionmaker' > </tr> </table> </form> </td> </tr> </table> </div> " ; } else { echo "Please <a href=\"login.php\">Login</a>."; } ?> <html> <?php include connect.inc; $id = $_GET['id']; mysql_query("UPDATE count SET clicks=clicks+1 WHERE id='$id'"); $sql = mysql_query("SELECT link FROM count WHERE id='$id'"); $fetch = mysql_fetch_row($sql); $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { echo "Name :{$row['id']} <br>" . "Subject : {$row['link']} <br>" . "Message : {$row['count']} <br><br>"; } mysql_close(); ?> <a href='/index.php?id=1'>link1</a> <a href='/index.php?id=2'>link2</a> </html> i hav dis checkstatus.php page where the user enters a random number sms to him..but after tht he shud be able to see d reply given by admin ..d problem over here is d user only views half of the field called 'anything' (my database is named "proj") heres my code jst cant understand why dis is happening...pls help hi all i am having a big problem that i have been trying to find out what is going on for weeks. i have a echo script that echos data that is in my database, and if i have to refresh the page it will add blank data in my database and the top echo info is blank as well. how can i fix this, and i was wanting to know how do i echo out my info in a textarea. i added a jepg to show you what i mean. here is my code echoforms.php <?php error_reporting(0); require_once('demo.php'); /*Open the connection to our database use the info from the config file.*/ $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); $sql = "SELECT company_name, contact_name, address, street_number, postcode, contact_number, contact_email, budget, description FROM 3dartactforms"; $results = mysql_query($sql); if (!$results) { die('Invalid query: ' . mysql_error()); } while($result = mysql_fetch_array( $results )){ echo '<div style="border: 1px solid #e4e4e4; padding: 15px; margin-bottom: 10px;">'; echo date("d/m/y"); echo '<p>Company Name: ' . $_POST['company_name'] . '</p>'; echo '<p>Contact Name: ' . $_POST['contact_name'] . '</p>'; echo '<p>Address: ' . $_POST['address'] . '</p>'; echo '<p>Street Number: ' . $_POST['street_number'] . '</p>'; echo '<p>Postcode: ' . $_POST['postcode'] . '</p>'; echo '<p>Contact Number: ' . $_POST['contact_number'] . '</p>'; echo '<p>Contact Email: ' . $_POST['contact_email'] . '</p>'; echo '<p>Budget: ' . $_POST['budget'] . '</p>'; echo '<p>Description: ' . $_POST['description'] . '</p>'; echo '</div>'; } ?> Hi i have this edit form that allows user to mofy data but the problems on the text box is that it deletes the rest of the data after the space from the first word i tried to increase the size of the varChars on mysql but did no work why it happens how can i stop from happening?? this the form input <input type="text" name="name" id="name" class='text_box' value="<?php echo $_GET['name'];?>"/> I'd like to use a text editor like this one: http://tinymce.moxiecode.com/examples/full.php for my forums. But I am not sure exactly how I would prevent abuse and injects to messed up the page, rather than being contained in the designated area it is meant for. Could some one please help me, I know htmlspecailchars will not work, since some of the code needs to render as html Here is what I am trying to accomplish: I have a students table with a studentID I also have a notes table and a sched table with studentID The sched table is working as planned where if the student is scheduled for more than one time he is displayed twice. However if there are multiple notes per student the student is display for each individual note where I would like only the most current note to be displayed Here is what the output is: 1- 10:30:00 - 10:50:00 student3 Three FST Teacher One Special1 One Writing Ratios 09/10 2- 10:30:00 - 10:50:00 student3 Three FST Teacher One Special1 One Needs to work on fractions and decimals 09/10 3- 13:00:00 - 14:00:00 student3 Three FST Teacher One Special1 One Writing Ratios 09/10 4- 13:00:00 - 14:00:00 student3 Three FST Teacher One Special1 One Needs to work on fractions and decimals 09/10 As you can see I have two notes and two schedule times for this student. what I want it to display is only line 1 & 3. which is the newest note in the system. Below is my code that I am using. Any help would be greatly appreciated. Code: [Select] <?php $result = mysql_query("SELECT * FROM students LEFT JOIN teachers ON students.teacherId = teachers.teacherId LEFT JOIN course ON students.courseId = course.courseId LEFT JOIN specialEd ON students.specialId = specialEd.specialId LEFT JOIN sched ON students.studentId = sched.studentId ORDER BY start "); echo "<table>"; while ($row = mysql_fetch_array($result)){ $id = "?id=" . $row['studentId']; echo "<tr>"; echo "<td>" . $row['start'] . " - " . $row['stop'] . "</td>"; echo "<td>" . "<a href='student.php$id'>" . $row['fName'] . " " . $row['lName'] . "</td>"; echo "<td>" . $row['courseName'] . "</td>"; echo "<td>" . $row['teachers_fName'] . " " . $row['teachers_lName'] . "</td>"; echo "<td>" . $row['special_fName'] . " " . $row['special_lName'] . "</td>"; echo "<td>" . $row['note'] . "</td>"; echo "<td>" . date("m/d", strtotime($row['started'])) . "</td>"; echo "</tr>"; } echo "</table>"; ?> Hi im new to php. what im trying to do is echo the result out to a textbox and can't seem to figure it out. I can echo the result to my screen just fine,its when i try to echo it oout to the textbox i cant figure out. I have added my code below. Thanks will Code: [Select] <?php //DATABASE CONNECTION// include 'include/test.php'; $team = $_POST["Team"]; $COUNT = 'COUNT(id)'; $query = "SELECT COUNT(id) FROM `teamrosters` WHERE TEAM = '$team' "; $result = mysql_query($query); // Print out result while($row = mysql_fetch_array($result)) { echo 'ROSTER COUNT: '. $row [$COUNT]; } echo mysql_error() ?> <h1 class="will"><span class="will">Welcome to B410 Team Rosters Page</span></h1> <p class="will"><span class="will">Just pick the team from the drop down menu you wan't to see and hit summit</span></p> <p> </p> <form action="formsummit.php" method="post" name="form1" id="form1"> <label for="Team" class="will">Team</label> <select name="Team" id="Team"> <option value="Auburn">Auburn</option> <option value="Texas">Texas</option> <option value="OSU">OSU</option> <option value="USC">USC</option> <option value="UCLA">UCLA</option> <option value="Vandy">Vandy</option> <option value="Michigan">Michigan</option> <option value="Texas AM">Texas AM</option> <option value="Texas Tech">Texas Tech</option> <option value="Colorado">Colorado</option> <option value="Washington">Wasington</option> <option value="Iowa ST">Iowa ST</option> </select> <input type="submit" name="summit" id="summit" value="Submit" /> <label for="text">avg team speed</label> <input type="text" name="text" id="text" value=" <?php echo $row ['COUNT(id)'];?> " /> </form> How would I open a text file from another server and echo it. http://mysite.com/news/feed.txt I have some problem when I want to echo out a text which is retrieve from my database and place it inside a text box but it stops showing when there's a space. If I echo it out outside of the textbox, then there's no problem. May I know how to resolve this problem. Thanks I have a .txt file containing hundreds of lines of Names (e.g. Brad, Jennifer, etc.) What coding can I use to only echo the first 20? Hi All, If someone types in my textarea without any hard returns, it echos the entire text on a single line, which expands my site very very far and screws up the layout. how can I echo the text but limit the number of characters per line before I insert my own line break? The code is just: Code: [Select] echo $message; ok, so I have this code to start with: Code: [Select] <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['username'])) { echo 'Please <a href="/login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql_1.php"; // Place Session variable 'id' into local variable $username1 = $_SESSION['username']; ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT hometown, about, month, day, year, id FROM general WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $userid = $row["userid"]; $hometown = $row["hometown"]; $about = $row["about"]; $month = $row["month"]; $day = $row["day"]; $year = $row["year"]; $userid1 = $row["id"]; } $sql = mysql_query("SELECT * from sessions WHERE username='$username1'"); while($row = mysql_fetch_array($sql)){ $name1 = $row["name"]; } ?> <?php if($month == "January"){ $month2 =="1";}else if($month =="February"){$month2 =="2";}else if($month =="March"){$month2 =="3";}else if($month =="April"){$month2 =="4";}else if($month =="May"){$month2 =="5";}else if($month =="June"){$month2 =="6";}else if($month =="July"){$month2 =="7";}else if($month =="August"){$month2 =="8";}else if($month =="September"){$month2 =="9";}else if($month =="October"){$month2 =="10";}else if($month =="November"){$month2 =="11";}else if($month =="December"){$month2 =="12";} ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * from pics WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $link123 = $row["link"]; } ?> <?php if(isset($_SESSION['username'])) { $query = "SELECT sport FROM sports where user ='$username1'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($sport) = $row; $cs .= "$sport<br> "; }} ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <script language="javascript" type='text/javascript'> function hideDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideShow').style.visibility = 'hidden'; } else { if (document.layers) { // Netscape 4 document.hideShow.visibility = 'hidden'; } else { // IE 4 document.all.hideShow.style.visibility = 'hidden'; } } } function showDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideShow').style.visibility = 'visible'; } else { if (document.layers) { // Netscape 4 document.hideShow.visibility = 'visible'; } else { // IE 4 document.all.hideShow.style.visibility = 'visible'; } } } </script> <script language="javascript" type='text/javascript'> function hideDiv1() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('apDiv4').style.visibility = 'hidden'; } else { if (document.layers) { // Netscape 4 document.apDiv4.visibility = 'hidden'; } else { // IE 4 document.all.apDiv4.style.visibility = 'hidden'; } } } function showDiv1() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('apDiv4').style.visibility = 'visible'; } else { if (document.layers) { // Netscape 4 document.apDiv4.visibility = 'visible'; } else { // IE 4 document.all.apDiv4.style.visibility = 'visible'; } } } </script> <style type="text/css"> #apDiv1 { position:absolute; left:0px; top:0px; width:100%; height:50px; z-index:1; background-color: #000; padding: 0px; text-align: left; } #menu { position:absolute; top:15px; width:411px; height:34px; z-index:41; right: 0px; } </style> <link rel="stylesheet" href="css/structure.css" type="text/css" /> <link rel="stylesheet" href="css/form.css" type="text/css" /> <!-- JavaScript --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/ libs/jquery/1.3.0/jquery.min.js"></script> <script type="text/javascript"> $(function() { $(".submit").click(function() { var name = $("#name").val(); var dataString = 'name='+ name; if(name=='') { $('.success').fadeOut(200).hide(); $('.error').fadeOut(200).show(); } else { $.ajax({ type: "POST", url: "join.php", data: dataString, success: function(){ $('.success').fadeIn(200).show(); $('.error').fadeOut(200).hide(); $(document).ready(function(){ $('#submit').click(function(){ var a = $("#name").val(); if(a != "") { $.post("join.php",{ }, function(response){ $('#posting').prepend($(response).fadeIn('slow')); $("#name").val("what's on your mind?"); }); } }); }); } }); } return false; }); }); </script> <style type="text/css"> .error{ color:#d12f19; font-size:12px; } .success{ color:#006600; font-size:12px; } </style> <link href="Spry-UI-1.7/css/Menu/basic/SpryMenuBasic.css" rel="stylesheet" type="text/css" /> <script src="Spry-UI-1.7/includes/SpryDOMUtils.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/SpryDOMEffects.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/SpryWidget.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/SpryMenu.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarKeyNavigationPlugin.js" type="text/javascript"></script> <script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarIEWorkaroundsPlugin.js" type="text/javascript"></script> <style type="text/css"> /* BeginOAWidget_Instance_2141544: #MenuBar */ /* Settable values for skinning a Basic menu via presets. If presets are not sufficient, most skinning should be done in these rules, with the exception of the images used for down or right pointing arrows, which are in the file SpryMenuBasic.css These assume the following widget classes for menu layout (set in a preset) .MenuBar - Applies to all menubars - default is horizontal bar, all submenus are vertical - 2nd level subs and beyond are pull-right. .MenuBarVertical - vertical main bar; all submenus are pull-right. You can also pass in extra classnames to set your desired top level menu bar layout. Normally, these are set by using a preset. They only apply to horizontal menu bars: MenuBarLeftShrink - The menu bar will be horizontally 'shrinkwrapped' to be just large enough to hold its items, and left aligned MenuBarRightShrink - Just like MenuBarLeftShrink, but right aligned MenuBarFixedLeft - Fixed at a specified width set in the rule '.MenuBarFixedLeft', and left aligned. MenuBarFixedCentered - - Fixed at a specified width set in the rule '.MenuBarFixedCentered', and centered in its parent container. MenuBarFullwidth - Grows to fill its parent container width. In general, all rules specified in this file are prefixed by #MenuBar so they only apply to instances of the widget inserted along with the rules. This permits use of multiple MenuBarBasic widgets on the same page with different layouts. Because of IE6 limitations, there are a few rules where this was not possible. Those rules are so noted in comments. */ #MenuBar { background-color:#000000; font-family: Arial, Helvetica, sans-serif; /* Specify fonts on on MenuBar and subMenu MenuItemContainer, so MenuItemContainer, MenuItem, and MenuItemLabel at a given level all use same definition for ems. Note that this means the size is also inherited to child submenus, so use caution in using relative sizes other than 100% on submenu fonts. */ font-weight: normal; font-size: 16px; font-style: normal; padding:0; border-color: #000000 #000000 #000000 #000000; border-width:0px; border-style: none none none none; } /* Caution: because ID+class selectors do not work properly in IE6, but we want to restrict these rules to just this widget instance, we have used string-concatenated classnames for our selectors for the layout type of the menubar in this section. These have very low specificity, so be careful not to accidentally override them. */ .MenuBar br { /* using just a class so it has same specificity as the ".MenuBarFixedCentered br" rule bleow */ display:none; } .MenuBarLeftShrink { float: left; /* shrink to content, as well as float the MenuBar */ width: auto; } .MenuBarRightShrink { float: right; /* shrink to content, as well as float the MenuBar */ width: auto; } .MenuBarFixedLeft { float: left; width: 80em; } .MenuBarFixedCentered { float: none; width: 80em; margin-left:auto; margin-right:auto; } .MenuBarFixedCentered br { clear:both; display:block; } .MenuBarFixedCentered .SubMenu br { display:none; } .MenuBarFullwidth { float: left; width: 100%; } /* Top level menubar items - these actually apply to all items, and get overridden for 1st or successive level submenus */ #MenuBar .MenuItemContainer { padding: 0px 0px 0px 0px; margin: 0; /* Zero out margin on the item containers. The MenuItem is the active hover area. For most items, we have to do top or bottom padding or borders only on the MenuItem or a child so we keep the entire submenu tiled with items. Setting this to 0 avoids "dead spots" for hovering. */ } #MenuBar .MenuItem { padding: 0px 24px 0px 0px; background-color:#000000; border-width:0px; border-color: #cccccc #ffffff #cccccc #ffffff; border-style: none solid none solid; } #MenuBar .MenuItemFirst { border-style: none none none none; } #MenuBar .MenuItemLast { border-style: none solid none none; } #MenuBar .MenuItem .MenuItemLabel{ text-align:center; line-height:1.4em; color:#ffffff; background-color:#000000; padding: 6px 15px 6px 39px; width: 10em; width:auto; } .SpryIsIE6 #MenuBar .MenuItem .MenuItemLabel{ width:1em; /* Equivalent to min-width in modern browsers */ } /* First level submenu items */ #MenuBar .SubMenu .MenuItem { font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size: 14px; font-style: normal; background-color:#ffffff; padding:0px 2px 0px 0px; border-width:0px; border-color: #cccccc #cccccc #cccccc #cccccc; /* Border styles are overriden by first and last items */ border-style: solid solid none solid; } #MenuBar .SubMenu .MenuItemFirst { border-style: solid solid none solid; } #MenuBar .SubMenu .MenuItemFirst .MenuItemLabel{ padding-top: 6px; } #MenuBar .SubMenu .MenuItemLast { border-style: solid solid solid solid; } #MenuBar .SubMenu .MenuItemLast .MenuItemLabel{ padding-bottom: 6px; } #MenuBar .SubMenu .MenuItem .MenuItemLabel{ text-align:left; line-height:1em; background-color:#ffffff; color:#333333; padding: 6px 12px 6px 5px; width: 7em; } /* Hover states for containers, items and labels */ #MenuBar .MenuItemHover { background-color: #666666; border-color: #cccccc #cccccc #cccccc #cccccc; } #MenuBar .MenuItemWithSubMenu.MenuItemHover .MenuItemLabel{ background-color: #666666; /* consider exposing this prop separately*/ color: #ffffff; } #MenuBar .MenuItemHover .MenuItemLabel{ background-color: #666666; color: #ffffff; } #MenuBar .SubMenu .MenuItemHover { background-color: #666666; border-color: #666666 #cccccc #cccccc #cccccc; } #MenuBar .SubMenu .MenuItemHover .MenuItemLabel{ background-color: #666666; color: #ffffff; } /* Submenu properties -- First level of submenus */ #MenuBar .SubMenuVisible { background-color: #ffffff; min-width:0%; /* This keeps the menu from being skinnier than the parent MenuItemContainer - nice to have but not available on ie6 */ border-color: #ffffff #ffffff #ffffff #ffffff; border-width:0px; border-style: none none none none; } #MenuBar.MenuBar .SubMenuVisible {/* For Horizontal menubar only */ top: 100%; /* 100% is at the bottom of parent menuItemContainer */ left:0px; /* 'left' may need tuning depending upon borders or padding applied to menubar MenuItemContainer or MenuItem, and your personal taste. 0px will left align the dropdown with the content area of the MenuItemContainer. Assuming you keep the margins 0 on MenuItemContainer and MenuItem on the parent menubar, making this equal the sum of the MenuItemContainer & MenuItem padding-left will align the dropdown with the left of the menu item label.*/ z-index:10; } #MenuBar.MenuBarVertical .SubMenuVisible { top: 0px; left:100%; min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse */ } /* Submenu properties -- Second level submenu and beyond - these are visible descendents of .MenuLevel1 */ #MenuBar .MenuLevel1 .SubMenuVisible { background-color: #ffffff; min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse*/ top: 0px; /* If desired, you can move this down a smidge to separate top item''s submenu from menubar - that is really only needed for submenu on first item of MenuLevel1, or you can make it negative to make submenu more vertically 'centered' on its invoking item */ left:100%; /* If you want to shift the submenu left to partially cover its invoking item, you can add a margin-left with a negative value to this rule. Alternatively, if you use fixed-width items, you can change this left value to use px or ems to get the offset you want. */ } /* IE6 rules - you can delete these if you do not want to support IE6 */ /* A note about multiple classes in IE6. * Some of the rules above use multiple class names on an element for selection, such as "hover" (MenuItemHover) and "has a subMenu" (MenuItemWithSubMenu), * giving the selector '.MenuItemWithSubMenu.MenuItemHover'. * Unfortunately IE6 does not support using mutiple classnames in a selector for an element. For a selector such as '.foo.bar.baz', IE6 ignores * all but the final classname (here, '.baz'), and sets the specificity accordingly, counting just one of those classs as significant. To get around this * problem, we use the plugin in SpryMenuBarIEWorkaroundsPlugin.js to generate compound classnames for IE6, such as 'MenuItemWithSubMenuHover'. * Since there are a lot of these needed, the plugin does not generate the extra classes for modern browsers, and we use the CSS2 style mutltiple class * syntax for that. Since IE6 both applies rules where * it should not, and gets the specificity wrong too, we have to order rules carefully, so the rule misapplied in IE6 can be overridden. * So, we put the multiple class rule first. IE6 will mistakenly apply this rule. We follow this with the single-class rule that it would * mistakenly override, making sure the misinterpreted IE6 specificity is the same as the single-class selector, so the latter wins. * We then create a copy of the multiple class rule, adding a '.SpryIsIE6' class as context, and making sure the specificity for * the selector is high enough to beat the single-class rule in the "both classes match" case. We place the IE6 rule at the end of the * css style block to make it easy to delete if you want to drop IE6 support. * If you decide you do not need IE6 support, you can get rid of these, as well as the inclusion of the SpryMenuBarIEWorkaroundsPlugin.js script. * The 'SpryIsIE6' class is placed on the HTML element by the script in SpryMenuBarIEWorkaroundsPlugin.js if the browser is Internet Explorer 6. This avoids the necessity of IE conditional comments for these rules. */ .SpryIsIE6 #MenuBar .MenuBarView .MenuItemWithSubMenuHover .MenuItemLabel /* IE6 selector */{ background-color: #666666; /* consider exposing this prop separately*/ color: #ffffff; } .SpryIsIE6 #MenuBar .MenuBarView .SubMenu .MenuItemWithSubMenuHover .MenuItemLabel/* IE6 selector */{ background-color: #666666; /* consider exposing this prop separately*/ color: #ffffff; } .SpryIsIE6 #MenuBar .SubMenu .SubMenu /* IE6 selector */{ margin-left: -0px; /* Compensates for at least part of an IE6 "double padding" version of the "double margin" bug */ } /* EndOAWidget_Instance_2141544 */ #apDiv2 { position:absolute; left:5px; top:75px; width:591px; height:284px; z-index:2; } #hideShow { position:absolute; left:84px; top:211px; width:506px; height:47px; z-index:2; } #apDiv3 { position:absolute; left:4px; top:354px; width:306px; height:45px; z-index:3; } #apDiv4 { position:absolute; left:82px; top:275px; width:290px; height:34px; z-index:4; } #apDiv5 { position:absolute; left:17px; top:205px; width:861px; height:172px; z-index:2; } .fullname { position:relative; left:0px; width:100px; height:30px; z-index:4; top:25px; background-color:black; color:white; text-align: center; } #apDiv5 #TabbedPanels1 .TabbedPanelsContentGroup .TabbedPanelsContent.TabbedPanelsContentVisible #form1 table tr td { text-align: right; } </style> <script type="text/xml"> <!-- <oa:widgets> <oa:widget wid="2141544" binding="#MenuBar" /> </oa:widgets> --> </script> <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #apDiv6 { position:absolute; left:4px; top:54px; width:162px; height:147px; z-index:3; } </style> </head> <body onLoad="javascript:TabbedPanels1.showPanel(<?php echo $_COOKIE['index'];?>)"> <?php $birthday1 = "$year-$month2-$day"; ?> <div id="apDiv1"> <div id="menu"> <ul id="MenuBar" class="MenuBarHorizontal"> <li><a href="index.php">Home</a> </li> <li><a href="profile.php">Profile</a></li> <li><a class="MenuBarItemSubmenu" href="#">Account</a> <ul> <li><a href="settings.php">Account Settings</a> </li> <li><a href="privacy.php">Privacy Settings</a></li> <li><a href="logout.php">Logout</a></li> </ul> </li> </ul> <script type="text/javascript"> // BeginOAWidget_Instance_2141544: #MenuBar var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", { widgetID: "MenuBar", widgetClass: "MenuBar MenuBarRightShrink", insertMenuBarBreak: true, mainMenuShowDelay: 100, mainMenuHideDelay: 200, subMenuShowDelay: 200, subMenuHideDelay: 200 }); // EndOAWidget_Instance_2141544 </script> </div> <a href="/main.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','/hover.png',1)"><img src="/main.png" name="Image1" width="600" height="50" border="0" id="Image1" /></a> </div> <?php // Process the form if it is submitted if ($_POST['general']) { $city1 = $_POST['city']; $hometown1 = $_POST['hometown']; $about1 = $_POST['about']; $sql = mysql_query("UPDATE general SET city='$city1', hometown='$hometown1', about='$about1' WHERE id='$userid1'")or die(mysql_error()); $message ='Your Account info has been saved'; echo "<font color = 'red'>"; echo $message; echo "</font>"; } // close if post ?> <div id="apDiv5"> <div id="TabbedPanels1" class="VTabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" tabindex="0">Basic Info</li> <li class="TabbedPanelsTab" tabindex="0">Profile Picture</li> <li class="TabbedPanelsTab" tabindex="0">Sports</li> <li class="TabbedPanelsTab" tabindex="0">Activities</li> <li class="TabbedPanelsTab" tabindex="0">Contact Info</li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"><form id="form1" name="form1" method="post" action=""> <label for="city"></label> <table width="496" border="0" cellspacing="2" cellpadding="0"> <tr> <td width="157" scope="col">Current City:</td> <td width="333" scope="col"><div align="left"> <input type="text" name="city" id="city" value="<?php echo $city; ?>" /> </div></td> </tr> <tr> <td>Hometown:</td> <td><div align="left"> <label for="hometown"></label> <input type="text" name="hometown" id="hometown" value="<?php echo $hometown; ?>" /> </div></td> </tr> <tr> <td>Birthday:</td> <td><div align="left"><?php echo $month;?> <?php echo $day; ?>, <?php echo $year; ?></div></td><tr><td></td><td> <div align="left"><?php //calculate years of age (input string: YYYY-MM-DD) function birthday ($birthday){ list($year,$month,$day) = explode("-",$birthday); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff = date("d") - $day; if ($day_diff < 0 || $month_diff < 0) $year_diff--; return $year_diff; } echo birthday($birthday1). " years old"; ?></div></td></tr></td> </tr> <tr> <td>About Me: </td> <td><label for="about"></label> <textarea name="about" id="about" cols="45" rows="5"></textarea></td> </tr> <tr> <td> </td> <td><div align="left"><input name="general" id="general" type="submit" value="Save information" class="fullname" /></div></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </form></div> <div class="TabbedPanelsContent"><form enctype="multipart/form-data" action="profile.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="900000000000000000000000000000000000000000000000000000000000000000000000000" /> Choose a file to upload: <div id="dynamicInput"> <p>Entry 1</p> <p> <br> <input type="file" name="uploadedfile[]"> </p> </div> <input type="submit" value="Upload File" id="submit" name="submit" /> </form> <?php if($_POST['submit']){ // Where the file is going to be placed $target_path = 'images/'.$username1.'/'; foreach ($_FILES["uploadedfile"]["name"] as $key => $value) { $uploadfile = $target_path . basename($_FILES["uploadedfile"]["name"][$key]); $uploadfile1 = basename($_FILES["uploadedfile"]["name"][$key]); //echo $uploadfile; if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$key], $uploadfile)) { $sql = mysql_query("UPDATE pics SET link='$uploadfile', name='$uploadfile1' WHERE user='$username1'")or die(mysql_error()); $sql = mysql_query("UPDATE facebook_posts SET pic='$uploadfile' WHERE f_name='$name1'")or die(mysql_error()); $sql = mysql_query("UPDATE facebook_posts_comments SET pic='$uploadfile' WHERE f_name='$name1'")or die(mysql_error()); echo $value . ' uploaded<br>'; } } } ?> </div> <div class="TabbedPanelsContent"><form autocomplete="off" enctype="multipart/form-data" method="post" name="form"> <div class="info" style="padding-left:20px"> <h2> </h2> <div></div> <div> <p>Sport: <input id="name" name="name" type="text" class="field text medium" value="" maxlength="255" tabindex="1" /> </p> <p></p> </div> <div></div> </div> <div class="buttons"> <input type="submit" value="Submit" style=" background:#0060a1; color:#FFFFFF; font-size:14px; border:1px solid #0060a1; margin-left:12px" class="submit" name="submit" id="submit"/><span class="error" style="display:none"> Please Enter Valid Data</span><?php if($_POST['submit']){ ?><span class="success" style="display:none"> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// <?php $sql123 = mysql_query("SELECT id, sport, user FROM sports WHERE user='$username1'"); while($row = mysql_fetch_array($sql123)){ $id = $row["id"]; $sport1 .= $row["sport"]; $user = $row["user"];} echo $sport1; ;} ?></span> </div> </form></div> <div class="TabbedPanelsContent">Content 4</div> <div class="TabbedPanelsContent">Content 5 </div> </div> </div> </div> <div id="posting" align="center"> <?php include_once "posting.php"; ?> </div> <div id="apDiv6"><?php echo '<img src="'.$link123.'" width="162""/>'; ?></div> <script type="text/javascript"> var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); </script> </body> </html> My goal is to make it so that where the really long comment(well with no words), is at that it runs after the ajax at the begining of the script so that the database input it does shows up in that result. here is the code of join.php Code: [Select] <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['username'])) { echo 'Please <a href="/login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql_1.php"; // Place Session variable 'id' into local variable $username1 = $_SESSION['username']; ?> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT hometown, about, month, day, year, id FROM general WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $userid = $row["userid"]; $hometown = $row["hometown"]; $about = $row["about"]; $month = $row["month"]; $day = $row["day"]; $year = $row["year"]; $userid1 = $row["id"]; } $sql = mysql_query("SELECT id, sport, user FROM sports WHERE user='$username1'"); while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $sport1 = $row["sport"]; $user = $row["user"]; } if($_POST) { $sport=$_POST['name']; mysql_query("INSERT INTO sports (id, sport, user) VALUES ('$userid1', '$sport', '$username1')"); }else { } ?> <html> <head> </head> <body> <?php echo $sport1; ?> </body> </html> I hope this makes sense. so once again, I need the results that the code by the long comment(sorta) will basically run after the ajax uses join.php to input info into the dbase. or is there a better way to do this? currently the results are loading even before the page loads. so that it returns the results when it is supposed to, it just didn't query the database at the right time. |