PHP - Need To Format My Output...
Hi, I am using a form to collect text data, and then spitting it out in an email. I need help formatting the way it looks in the email. How can I modify the following code so that it displays with the name of the award in the left cell and the winner (collected from the form) in the right cell. Left cell should justify to the right and right cell justify to the left and be bold.
Any help would be great. Thanks. $message = "A nomination form has been received. Nominees a \r\n\r\n"; $message .= "Ray O. Duncan Award: $duncan\r\n\r\n"; $message .= "Honor Award: $honor\r\n\r\n"; $message .= "Young Professional Award: $young\r\n\r\n"; $message .= "Bea N. Orr Student Award: $orr\r\n\r\n"; $message .= "Scholar Award: $scholar\r\n\r\n"; $message .= "Ethnic Minority Grad Fellow Award: $gradfellow\r\n\r\n"; $message .= "Recreation/Leisure Leadership Award: $rec\r\n\r\n"; $message .= "Elementary Teacher of the Year: $etoy\r\n\r\n"; $message .= "Middle School Teacher of the Year: $mtoy\r\n\r\n"; $message .= "High School Teacher of the Year: $htoy\r\n\r\n"; $message .= "K12 Dance Educator of the Year: $danceEd\r\n\r\n"; $message .= "Health Educator of the Year: $health\r\n\r\n"; Similar Tutorials
Hello All, function convertTimeFormat($time12Hour) { // Initialized required variable to an empty string. $time24Hour = ""; // Used explode() function to break the string into an array and stored its value in $Split variable. $Split = explode(":",$time12Hour); // print_r(explode (":", $time12Hour)); => Array ( [0] => 09 [1] => 50 [2] => 08AM ) // Retrieved only "hour" from the array and stored in $Hour variable. $Hour = $Split[0]; $Split[2] = substr($Split[2],0,2); // Used stripos() function to find the position of the first occurrence of a string inside another string. if($Hour == '12' && strpos($time12Hour,"AM")!== FALSE) { // Code here } elseif(strpos($time12Hour,"PM")!== FALSE && $Hour != "12") { // code here } return $time24Hour; } $time12Hour = "09:50:08AM"; $result = convertTimeFormat($time12Hour); print_r($result); /* Input : "09:50:08AM"; Output : "21:50:08PM"; */
Hi all, I am currently making a website that has e-custom functions and a back end for the client. I want them to be able to upload images - but they need to be transparent. I do not want to leave this in the hands of the client, so I am looking at ways of using the GD library to make the change I got no issue with the png/gif type for upload/resize function since this type already transparent background but my major problems is how to deal with jpeg/jpg image type which is their background was not a transparent...so is it possible I can change/ convert to png/gif type upon successful of uploading image...so the new final image will be png/gif type with transparent background...is it doable...I am not even sure it is possible...? Thanks for any help.. Well I have a script that executes a scan on a system set to run infinitely, and I need it to echo out a message each time it loops through, but I don't want it to echo out the message with the next loop message below it, and the next one below that etc... I've tried using the flush(); function and been messing around with that with no luck. For security reasons I don't want to release any of the processing code, but here is the basic construction of the script: <?PHP ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $RepeatIt = -1; for($g=1; $g!=$RepeatIt+1; $g++) { ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $ScanMessage = ":.:.: SCANNING THE HITLIST FOR MOBSTER: ".$MobName." (SCAN #$g) :.:.:"."<br/><br/>"; echo $ScanMessage; ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** } ?> At the moment it's returning: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #1) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #2) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #3) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #4) :.:.: So what I want it to do is just delete the scanning message and replace it with the next scan message so while running this script you would see just the number increment on the same line. Any suggestions? Thanks. Hi im desperately in need of some help here.. Im exporting my html page data to csv but i am unable to get the data onto a new column the code is as follows HTML FORM Code: [Select] <form id="form1" name="form1" method="post" action="index.php"> <table class="formatTblClass"> <tr> <th colspan="6"><?=$message;?></th> </tr> <tr> <td width="68"><span>First Name</span></td> <td width="215"><input class="Name" type="text" name="fn" id="fn" /></td> <td width="62"><span>Last Name</span></td> <td colspan="3"><input class="Name" name="ln" type="text" id="ln" size="50" /></td> </tr> <tr> <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="71">Address</td> <td width="721"><input class="Address" name="address" type="text" id="address" size="100" /></td> </tr> </table></td> </tr> <tr> <td><span>City</span></td> <td><input class="City" type="text" name="city" id="city" /></td> <td><span>State</span></td> <td width="148"><input class="State" type="text" name="state" id="state" /></td> <td width="24"><span>ZIP</span></td> <td width="255"><input class="ZIP" type="text" name="zip" id="zip" /></td> </tr> <tr> <td><span>Phone</span></td> <td><input class="Phone" type="text" name="phone" id="phone" /></td> <td><span>Email</span></td> <td><input class="Email" type="text" name="email" id="email" /></td> <td><input name="emailMe" type="checkbox" id="emailMe" value="Yes" checked="checked" /></td> <td>Please send me email</td> </tr> <tr> <td colspan="6"><span>Comments <textarea name="comments" id="comments" cols="45" rows="5"></textarea> </span> <div align="center"> <input type="submit" name="Submit" id="Submit" value="Submit" /> <input type="reset" name="Reset" id="button" value="Reset" /> </div></td> </tr> </table> </form> <?php // Receiving variables @$pfw_ip= $_SERVER['REMOTE_ADDR']; @$fn = addslashes($_POST['fn']); @$ln = addslashes($_POST['ln']); @$address = addslashes($_POST['address']); @$city = addslashes($_POST['city']); @$state = addslashes($_POST['state']); @$zip = addslashes($_POST['zip']); @$phone = addslashes($_POST['phone']); @$email = addslashes($_POST['email']); @$emailMe = addslashes($_POST['emailMe']); @$comments = addslashes($_POST['comments']); // Validation //saving record in a text file $pfw_file_name = "formtest.csv"; $pfw_first_raw = "fn,\rln,\raddress,\rcity,\rstate,\rzip,\rphone,\remail,\remailMe,\rcomments\r\n"; $pfw_values = "$fn,\r$ln,\r$address,\r$city,\r$state,\r$zip,\r$phone,\r$email,\r$emailMe,\r".str_replace ("\r\n","<BR>",$comments )."\r\n"; $pfw_is_first_row = false; if(!file_exists($pfw_file_name)) { $pfw_is_first_row = true ; } if (!$pfw_handle = fopen($pfw_file_name, 'a+')) { die("Cannot open file ($pfw_file_name)"); exit; } if ($pfw_is_first_row) { if (fwrite($pfw_handle, $pfw_first_raw ) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } } if (fwrite($pfw_handle, $pfw_values) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } fclose($pfw_handle); echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>thanx</font></p>"); ?> THIS IS THE OUTPUT I GET fn ln address city state zip phone emailMe comments Tom Sawyer shady lane new york new york NY124 123456789 tom@sawyer.com Yes comments THIS IS THE OUTPUT I AM LOOKING FOR fn Tom Harry ln Sawyer Potter address shady lane magic lane city new york xyz state new york xyz zip NY124 12343 phone 123456789 987654321 email tom@sawyer.com harry@magic.co.uk emailMe Yes Yes comments comments this is the comment please help me on this one.. unable to get the script export the data in top to bottom columnwise format echo "<font color='000000'>No Service Found At<br /></font>"<font color='000000'> .long2ip($ip)</font>; Hi Guys
In MYSQL the date format seems to be YYYY-MM-DD, when I use a dynamic table in Dreamweaver the date is also displayed this way, is there a simple way to change this to UK format DD-MM-YYYY?
I have my array like so Code: [Select] $inaque = array("'$dir'"=>"'$company'"); When I run Code: [Select] print_r($inaque); It shows like Code: [Select] Array ( ['share_what_you_want'] => 'Share What You Want' ) How can I get this array to print out like Code: [Select] array ( 'share_what_you_want' => 'Share What You Want' ) Without the [ ] This is the format that is needed for this code that has already been written by somebody else. Thanks in advance The raw output is this.. full example: http://instant.simplyhired.com/a/jobs/xml-v1/l-06238/q-engineer/ws-100/si-0/fdb-21/sb-rd/mi-10 I can generally get the value of this stuff.. like if I wanted the "jt" line I can get ENGINEER, and the rest of the data.. what i am having trouble with is getting the attribute (i think thats the right term for this with XML). For example the "src" line it as an attribute "url=" I am trying to figure out how to get that value.. Below is a sample of the raw.. and below that is the code I am working with to load up the XML. I know theres simple_xml but in my case thats not an option so I am working on slightly custom work (as little as it is). Code: [Select] <r> <jt>ENGINEER</jt> <cn url="">Soldream</cn> <src url="http://instant.simplyhired.com/a/job-details/view/jobkey-5109.J3H3036RVZPZ4RFRRKR/jp-0/hits-70?aff_id=2512">CareerBuilder</src> <loc cty="Tolland" st="CT" postal="06084" county="" region="" country="US">Tolland, CT</loc> <ls>2011-02-20T13:28:39Z</ls> <dp>2011-02-18T08:00:00Z</dp> <e>Engineer/CNC Machinist Tolland CT2429177 Aerospace MFG Co. seeks MFG/Design Engineer &amp; CNC Machinist with 5+ years of experience in aerospace manufacturing. Duties for engineers include developing new processes, drafting, and CNC programming. CNC Machinist should have knowledge of FANUC control. Send resume to...</e> <af></af> <pl url=""/> </r> $feedURL = 'http://instant.simplyhired.com/a/jobs/xml-v1/l-06238/q-engineer/ws-100/si-0/fdb-21/sb-rd/mi-10'; $doc = new DOMDocument(); $doc->load($feedURL); $arrFeeds = array(); foreach ($doc->getElementsByTagName('r') as $node) { $itemRSS = array ( 'title' => $node->getElementsByTagName('jt')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getAttributeNode('src'), 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, 'creator' => $node->getElementsByTagName('creator')->item(0)->nodeValue, 'permaz' => $node->getElementsByTagName('guid')->item(0)->nodeValue ); array_push($arrFeeds, $itemRSS); //print_r($arrFeeds); } array_unique($arrFeeds); ?> death.announcement.contact.php The above file format is correct? thank you Hello!! i want to save datetimes into a mysql database. Their format is dd-mm-yy hh:mm. I think mysql format for datetime is yy-mm-dd hh:mm..How can i convert them?? What Date Format is this... Code: [Select] echo '<div class="date">Published: ' . date('F j, Y', strtotime($publishedOn)) . '</div>'; And where can I find a listing of the different Date and Time Formats that will work with this? (I would like to display my date as "2012-02-26 2:40pm" for what it is worth...) Thanks, Debbie Hi guys I have this date script below which displays like so: 16/09/2011. Its fine but I now like it to display like this: 16 September 2011 Please I need help in twicking the code to do this Thanks! <?php //check to see if passing variable is set i.e. if true get day, month, year. if(isset($_GET['day'])){ $day = $_GET['day']; } else{ //Get today's date and put them in date, month, year $day = date("d"); } if(isset($_GET['month'])){ $month = $_GET['month']; } else{ $month = date("m"); } if(isset($_GET['year'])){ $year = $_GET['year']; } else{ $year = date("Y"); } echo $day."/".$month."/".$year; ?> Hi Guys, I'm sure i have done this before, is there a way to shorten dates like: December 16, 2010 to Dec 16, 2010 and January 16, 2010 to Jan 16, 2010 etc, i have used $dateFormatted2 = date("F j, Y", strtotime($d2)); to get the date format i have now. any help would be appreciated thansk guys Graham how should this be formated right now it's just outputting .long2ip($ip) '$playerlog admin logged into .long2ip($ip)' WHERE username='$player'") Hi Guys Could somebody tell me how i would put a line break into the code below i.e: 1.07 <br /> 2010 <?php echo date('d.m.Y',strtotime($news['created_at']));?> Thanks for your help how can I have this pull records of = or < userlevel SELECT * FROM site_jobs WHERE level_required ='$userlevel I want it to pull records that are also < that $userlevel Code: [Select] $date =date("d F Y"); It will display 18 October 2011. If I need it to display 2011-10-18. How do it go about coding it? I have my date set in my database as: 2010-12-13 08:00:00 What I would like to do is use PHP to format the date when pulled out the database to say: December 13, 2010. I really do not need the time if we can toss that. I wish it was as easy as changing info in the database directly, but with teh way everything has been programmed, it would be too much work. Here is an example: $data = mysql_query("SELECT * FROM jos_jevents_repetition") or die(mysql_error('Error connecting to the database')); while ($row = mysql_fetch_array($data)) { echo "<label for='name'>Dates</label>", "<select type='text' name='name'>", "<option value=''>Please Select A Date </option>", "<option value='".$row['startrepeat']."'>".$row['startrepeat']." </option>", "</select>"; } Anyone know what's up with this? <?php $days = floor($posts['timestamp'] / (60 * 60 * 24)); $remainder = $posts['timestamp'] % (60 * 60 * 24); $hours = floor($remainder / (60 * 60)); $remainder = $remainder % (60 * 60); $minutes = floor($remainder / 60); $seconds = $remainder % 60; if($days > 0) { echo date("d/m/y", $posts['timestamp']); echo " at "; echo date("H:i", $posts['timestamp']); }elseif($days == 0 && $hours == 0 && $minutes == 0) { echo "few seconds ago"; }elseif($days == 0 && $hours == 0) { echo $minutes.' minutes ago'; }elseif($days == 0 && $hours > 0){ echo $hours.' hour ago'; }else{ echo "few seconds ago"; } ?> I've read up on the urlendcode functions in the PHP user manual, but it's all very confusing. How would I convert a simple string that was creeated by a text input to a format such as this: site.com/articles/Some-URI |