PHP - Form Automatic Fill Space Between Years
I have this form:
Similar Tutorialshey guys thanks for the upcoming support how do I set the blue to fill up the remaining width of the while maininfo div? I tried setting the width:auto <div class="maininfo"> <div class="large">2</div> <div class="smallblock"> <div class="smalltop">3</div> <div class="small">4</div> </div> <div class="smallblock"> <div class="smalltop">5</div> <div class="small">6</div> </div> </div> .maininfo { width: 600px; } .large { float: left; height: 95px; background-color: blue; width:auto; } .smallblock { float: right; height: 90px; margin: 0 0 0 5px; width: 20%; } .small { background-color: red; height: 50%; width: 100%; } .smalltop { background-color: red; height: 50%; width: 100%; margin-bottom:5px; }Edit fiddle - JSFiddle Hi Guys, In a form within PHP coding i can get the the next 10 years with the following code: Code: (php) [Select] <?php $date_future = date("Y", strtotime('+10 year')); $date_year = date("Y"); for($i=$date_year;$i<$date_future;$i++){ if($date_year == $i){ echo "<option value=\"$i\" selected=\"selected\">$i</option> \n"; } else { echo "<option value=\"$i\">$i</option> \n"; } } ?> I have tried to mess about with the same code and try and get it to work for the last 10 years without any luck. He's what i did: Code: (php) [Select] <?php $date_past = date("Y", strtotime('-10 year')); $date_year = date("Y"); for($i=$date_year;$i>$date_past;$i++){ if($date_year == $i){ echo "<option value=\"$i\" selected=\"selected\">$i</option> \n"; } else { echo "<option value=\"$i\">$i</option> \n"; } } ?> I would appreciate any help with this. Hi i have this drop down list current the year is 2010 and downwards but i want to change the list to 2010 upwards u can notice on the 50-- so shows current year minus so current is 2010 to 61 how can i change 2010 to 2030 or sunfin?? echo '<select name="year_of_birth">',"\n"; $year = date("Y"); for ($i = $year;$i > $year-50;$i--) { if($i == $thisYear) { $s = ' selected'; } else { $s=''; } echo '<option value="' ,$i, '"',$s,'>' ,$i, '</option>',"\n"; } echo '</select>',"\n"; Hi Guy, First Post ..so please help! I have rows returning from a mYSQL Database which I put in a form which is php generated and im sending this form to the next page with a SUBMIT button. I want PHP/Javascript to do this automatically when the data is loaded from the MYSQL Table Ive tried fsockpen and document.form.submit() but it doesnt seem to work Any help. Thanks in Adv, Hittesh Ahuja <?php session_start(); if(isset($_POST['submit'])) { header("Location: http://localhost/PHP/brk_plan.php"); } ?> <!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> </head> <body> <p> <?php require_once('connect.php'); $email=$_SESSION['email']; $query="SELECT glycemic_index.gi_id,glycemic_index.value FROM food_preference JOIN glycemic_index ON glycemic_index.gi_id=food_preference.gi_id WHERE food_preference.email='$email' and glycemic_index.value >= 55 " or die("Update not Possible"); $result=mysql_query($query); $session_array=array(); echo "<form method='post' action='brk_plan.php' name='recommend'>"; echo "<p>This area is filtered from the user's table showing values only > 55</p>"; while($row=mysql_fetch_array($result)) { echo "Instead of: ".$row[0]."-".$row[1]."<br/>"; $one=$row[0]; $one_trimmed=substr($one,2,strlen($one)-5); $one_search="%".$one_trimmed."%"; $query2="SELECT glycemic_index.gi_id,glycemic_index.value,glycemic_index.food FROM glycemic_index WHERE glycemic_index.gi_id LIKE '$one_search' AND glycemic_index.value <55 AND glycemic_index.gi_id!='$row[0]' ORDER BY RAND() LIMIT 1 "; $result2=mysql_query($query2); while($row2=mysql_fetch_array($result2)) { echo "<input type='hidden' value='$row2[2]' name='fields[]'></input>"; echo "<p>You can have ".$row2[2].": ".$row2[0]."-".$row2[1]."</p>"; } } echo "<input type='submit' name='submit' value='dikha!'></input>"; echo "</form>"; //$_SESSION['higher_gi']=$session_array; //foreach($session_array as $value) //{ // echo $value."<br/>"; //} ?> </p> <p></p> <p></p> <p></p> <p></p> <p> </p> </body> </html> Hi, i am still trying to learn html and php, but i am also trying to create a website which contains a registration form. I want the validation of each field of that form to be performed automatically. So using onBlur, whenever the user steps out of a textbox field, i want to execute a php function located in another file, which will check the value of the field and display a note if the value is invalid. I want to do this using as less javascript as possible. I am not sure if what i am asking is possible but if it is i would like to know the easiest way to do this. I would appreciate any help i can get. Thanks for your time. Any suggestions for using to php to take html form data and fill a pdf form? Anything for cakephp? Thanks Hi All Not sure if this is possible, but I spend loads of time filling in the same form on a 3rd party website when people send me their details to check. Is there any way I am able to build a php script to read and check their details (can do this bit) and then submit them to a form on another website (can't do this bit)? The form is a hotel booking form and is spread over 4 pages. Hi, I've got a pdf catalog which posts an order to a php form. The idea is that that the php page looks like an order form that the client can check before finally hitting 'submit' (i.e. along the lines of go to shopping cart). I'd like the php page to be editable. Meaning clients can not only look at their echoed order, but change it before committing to it. So the catalog order gets put into a php submit form with editable fields. I've read that others have accomplished this with statements like: Code: [Select] value="<?php echo $clientName; ?>" Which should fill the client name input box on the order form with the posted variable. But it doesn't work properly for me, instead, the form field is filled with "<?xml version=" with the expected name on the line benath the input box and " /> on the line beneath that. Placing the input box declaration entirely within php tags doesn't work either (exactly the same output). Code: [Select] <?php echo ("Name: <input class=\"inputbox\" type=\"text\" name=\"clientName\" maxlength=\"40\" value=\"$clientName\"><br>"); ?> Can anyone help? Steve Hi, I am using this code, what i want is to random fill up stepa field with either option a or option b every time i refresh the page, any help is highly appreciated!:
<form action="myc.php" method="get"> <label for="element_1"> </label> <div> <select class="element select medium" name="stepa"> <option value="" selected="selected"></option> <option value="option a" >Advanced Human option a</option> <option value="option b">Advanced Human Option b</option> </select> </div> <br> <input type="submit"> </form>
I am creating a simple web application that allows the user to update information in a database. I have a selector that allows the user to select what record they want to update and then a form field to insert the data to be updated. I want the form to to be passed the data from the selected entry "when selected" to auto-complete the default values of the text fields so the user can see the information right in the text fields. This is the form Code: [Select] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Tom's Culture Database</title> <meta name="GENERATOR" content="Quanta Plus"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <style> body { } h3 { color: #585858; } h4 { color : #c00000; } th { background : #000000; border : #ffffff solid 1px; color : #ff0000; text-align : left; } .form_wrapper { background : #000000; padding : 10px; border : solid 2px; } #form_inner { padding : 0 0 0 5px; display : inline-block; } td { border : #000000 solid 1px; } </style> <body> <?php //CONNECT INCLUDE require("connect.php"); //SELECT DATABASE $sql_user_info = mysql_query("SELECT * FROM collections ORDER BY id ASC"); //BEGIN FORM echo "<h3>Select an entry to update or delete!</h3> <form action='mysql_update_action.php' method='POST'><select name='name_select'>"; while ($row = mysql_fetch_assoc($sql_user_info)) { $id = $row['id']; $genus = $row['genus']; $species = $row['species']; $strain_name= $row['strain_name']; echo " <option value = '$id'>$id : $genus $species $strain_name</option> "; } echo "</select> <br><br><br> <DIV class='form_wrapper'> <DIV id='form_inner' align=\"left\"><h4>Genus Name:</h4><INPUT type=\"text\" name=\"to_change_genus_name\"></DIV> <DIV id='form_inner' align=\"left\"><h4>Species Name:</h4><INPUT type=\"text\" name=\"to_change_species_name\"></DIV> <DIV id='form_inner' align=\"left\"><h4>Strain Name:</h4><INPUT type=\"text\"name=\"to_change_strain_name\"></DIV> <DIV id='form_inner' align=\"left\"><h4>P-Value:</h4><INPUT type=\"text\" name=\"to_change_p_value\"></DIV> <DIV id='form_inner' align=\"left\"><h4>Origin:</h4><INPUT type=\"text\" name=\"to_change_origin\"></DIV> <DIV id='form_inner' align=\"left\"><h4>Get From:</h4><INPUT type=\"text\" name=\"to_change_get_from\"></DIV> <DIV id='form_inner' align=\"left\"><h4>Qty:</h4><INPUT type=\"text\" name=\"to_change_qty\"></DIV> <DIV id='form_inner' align=\"left\"><h4>Created:</h4><INPUT type=\"text\" name=\"to_change_date_created\" value=\"M/D/Y\"></DIV><br> <DIV id='form_inner' align=\"left\"><h4>Working Collection:</h4><INPUT type=\"checkbox\" name=\"to_change_work_collection\"></DIV> <DIV id='form_inner' align=\"left\"><h4>DNA Check:</h4><INPUT type=\"checkbox\" name=\"to_change_dna_check\"> </DIV> <br><br> <INPUT type='submit' name='change' value='Update'> <INPUT type='submit' name='name_delete' value='Delete'> </form></DIV>"; //END FORM ?> <?php //SELECT DATABASE $sql_user_info = mysql_query("SELECT * FROM collections ORDER BY id"); while ($row = mysql_fetch_assoc($sql_user_info)) { $id = $row['id']; $genus = $row['genus']; $species = $row['species']; $strain_name = $row['strain_name']; $p_value = $row['p_value']; $origin = $row['origin']; $get_from = $row['get_from']; $qty = $row['qty']; $work_collection = $row['work_collection']; $dna_check = $row['dna_check']; $date_created = $row['date_created']; $last_modified = $row['last_modified']; if ($work_collection == "0"){ $work_collection = "no"; } else { $work_collection = "yes"; } // Define $color=1 echo "<br>"; echo "<table width='400' border='1' align='left' cellpadding='2' cellspacing='0'>"; echo "<tr><th>ID</th><th>Genus</th><th>Species</th><th>Strain Name</th><th>P-Value</th></tr>"; $color= 1; // If $color==1 table row color = #FFC600 if($color==1){ echo "<tr bgcolor='#808080'><td>".$id."</td><td>".$genus."</td><td>".$species."</td></tr>"; // Set $color==2, for switching to other colors $color=2; } // When $color not equal 1, use this table row color else { echo "<tr bgcolor='#ffffff'><td>".$id."</td><td>".$genus."</td><td>".$species."</td></tr>"; // Set $color back to 1 $color='1'; } echo "</table>"; } ?> </body> </html> This is the update actions Code: [Select] <?php //CONNECT INCLUDE require("connect.php"); //GRAB DATA $name_select = $_POST['name_select']; $name_delete = $_POST['name_delete']; $to_change_genus_name = $_POST['to_change_genus_name']; $to_change_species_name = $_POST['to_change_species_name']; $to_change_strain_name = $_POST['to_change_strain_name']; $to_change_p_value = $_POST['to_change_p_value']; $to_change_origin = $_POST['to_change_origin']; $to_change_get_from = $_POST['to_change_get_from']; $to_change_qty = $_POST['to_change_qty']; $to_change_work_collection = $_POST['to_change_work_collection']; $to_change_dna_check = $_POST['to_change_dna_check']; $to_change_date_created = $_POST['to_change_date_created']; $date = strtotime("now"); $current_date = date("m/d/y", $date); if ($name_select&&$to_change_genus_name&&$_POST['change']) { $change = mysql_query("UPDATE collections SET genus='$to_change_genus_name', species='$to_change_species_name' WHERE id='$name_select'"); echo "<br><h2>Data updated</h2><br>"; header( 'Location: http://localhost/sam/Mycelium.eu/mysql_update.php' ) ; } elseif ($_POST['name_delete']) { $delete = mysql_query("DELETE FROM collections WHERE id='$name_select'"); echo "<br><h2>Data deleted</h2><br>"; header( 'Location: http://localhost/sam/Mycelium.eu/mysql_update.php' ) ; } else echo "Please enter some Information"; header( 'Location: http://localhost/sam/Mycelium.eu/mysql_update.php' ) ; ?> Can someone help me with this.. I cannot figure out why it will not log in.. The actual url and user/pass are valid so feel free to test the live site. <?php // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, 'http://www.handy-hanky.com/shirley/homesell_cron.htm'); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'user=tom&pass=test&login_theme=cpanel'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (FORM LOGIN) $store = curl_exec ($ch); echo "STORE = $store<br>"; // CLOSE CURL curl_close ($ch); ?> I can determine 3 years from today, but How do determineo 3 years from march 1st? So I want to echo out "3/1/2013"? Thanks! Hi everyone, I'm writing a science fiction wordpress blog set 10 years into the future. I basically need all posts to display as if they are 10 years from now. Eg. posts needs to display as: February 7, 2021 instead of February 7, 2011 This will be for every post that I write. How can I automatically add 10 years to every post date? (And where would I put that code?) Currently, the wordpress php is calling the date with `<?php the_time(__('M j, Y')) ?>` I realise it's a bit of an odd request, but it's necessary for this particular project. I know it's possible - but I'm brand new to php and am not sure how. =) I hope someone out there can help. It would be very much appreciated. many thanks in advance Luke Ok so here is my code. Ignore the $_POST['dobm']. That is part of the whole script. All I want to know is how to set the list from 1998 to 1911 in descending order. I already tried making $i = 1998 and make $i - 1 til $i >= 1911. It seems to go in an infinite loop when I do that. Code: [Select] <?php for($i = 1911; $i <= 1998; $i++) { if ($_POST['dobm'] == $i) { echo '<option selected="selected" value="'.$i.'">'.date('Y', mktime(0,0,0,0,0,$i+1)).'</option>\n'; } else { echo '<option value="'.$i.'">'.date('Y', mktime(0,0,0,0,0,$i+1)).'</option>\n'; } } ?> I am searching the database for items that are plaques. There are different years of plaques. I find all the plaques sorted by year. My display puts them in rows of 4 max. What I want is to display them by year with a different year on a different line. Right now there are 4 (1963), 3 (1965), 1 (1978) all bunched together. 1963, 1963, 1963, 1963, 1965, 1965, 1965, 1978 What I want is: 1963, 1963, 1963, 1963, 1965, 1965, 1965, 1978, Any help would greatly be appreciated. <?php include 'config0.php'; $search=$_GET["search"]; // Connect to server and select database. mysql_connect($dbhost, $dbuser, $dbpass)or die("cannot connect"); mysql_select_db("$dbname")or die("cannot select DB"); $result = mysql_query("SELECT * FROM table1 WHERE plaques LIKE '%$search%' ORDER BY year") or die(mysql_error()); // store the record of the "" table into $row //$current = ''; // keeps getting the next row until there are no more to get if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 4; echo "<table align=center>"; echo "<br>"; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; echo "<td align=center>"; ?> <div style="float: left;"> <div><img src="<?php echo $tn; ?>"></div> </div> <?php echo "</td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i > 0) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; echo '</tr>'; } mysql_close(); ?> </table> How can i group the data by year to build the graph I need the data to be like so 2012 0 - total customers 0 - total customers 0 - total customers 0 - total customers 0 - total customers 9 - total customers 5 - total customers 3 - total customers 5 - total customers however i only have this data Code: [Select] total_customers month year 1 Aug 2011 9 Oct 2011 8 Nov 2011 4 Dec 2011 4 Jan 2012 so i need to make it show 0 for the months i dont have data for Code: [Select] <div id="dash_chart" class="portlet x9"> <div class="portlet-header"> <h4>Customer Growth</h4> <ul class="portlet-tab-nav"> <li class="portlet-tab-nav-active"><a href="#tab1" rel="tooltip" title="Customers">Customers </a></li> <li class=""><a href="#tab2" rel="tooltip" title="Sales over last 48 hours.">Sales </a></li> </ul> </div> <!-- .portlet-header --> <div class="portlet-content"> <div id="tab1" class="portlet-tab-content portlet-tab-content-active"> <?php echo '<table class="stats" title="area" width="100%" cellpadding="0" cellspacing="0"> <caption>Customer Base Growth</caption> <thead> <tr>'; $monthNames = Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); $i = 0; foreach ($monthNames as $month){ echo '<th>'.$month.'</th>'."\n"; } echo '</tr> </thead>'; $q = "SELECT count(cus_id) as total_customers, DATE_FORMAT(sign_date, '%b') as month, YEAR(sign_date) as year FROM customers GROUP BY YEAR(sign_date), MONTH(sign_date) ORDER BY sign_date ASC"; $r = @mysqli_query ($dbc, $q); $data = array(); if (mysqli_affected_rows($dbc) >= 1) { echo '<tbody> <tr> <th>2011</th>'; while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { } } echo '</tr>'; ?> <tr> <th>2012</th> <td>3</td> <td>4</td> <td>2</td> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>3</td> <td>5</td> <td>3</td> <td>9</td> </tr> </tbody> </table> Hello All, I have a News database in which articles are entered in. Right now all the stories are being display in one big page with every story on it. What I would like to do is to create an "archive" in which it automatically organizes the stories by their date. For example. 2011 February January 2010 December November October September etc... etc... I have a datetime field for the database, and I know how to do this all manually, but I can't figure out how to make it automatically add a month each month. It would be too much maintanence to have to update this every month. I also don't know what this would be called, so I don't even know what to search for. I've tried blog and news, but doesn't seem to be what I want. Any help would be appreciated! if(!is_array($e)) { $fulldisp = 1; $e = array('title' => 'No Entries Yet', 'entry' => '<a href="../admin.php">Post an entry!</a>' ); } } // Add the $fulldisp flag to the end of the array array_push($e, $fulldisp); return $e; } can someone please tell me why I'm getting this notice ? Notice: Undefined variable: e in /var/www/blog/inc/functions.inc.php on line 40 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=318996.0 I write with Object orientated programming style in all languages where possible. Languages i am experienced with: PHP4/PHP5 Mysql/Mysqli/PDO CSS/CSS3 Html/html5 Javascript (i prefer not to use libraries but i can use jquery just fine). C++ Console C# Silverlight C# windows phone 8.1 Graphic design: Photoshop cs6 fireworks cs6 (i prefer not to use fireworks though) Familiar operating systems: Linux Windows Extra info: I work with Apache and have experience maintaining the server. I like to work over SSH (secure shell). I program in Notepad or command prompt only!. I do not use frameworks or special software! Again i am looking for IMMEDIATE work. Thanks Sometimes i over think things and need to be told EXACTLY what it is you want VERY SLOWLY. |