PHP - How To Change The Default Font
In PHP when you post a form the default font is Times New Roman how do I changes the font to arial
Similar TutorialsHi, I have the following code to change font color from within an IF staement but I can't seem to sort it out. //code if ($server['b']['ip'] == $adminarray1[6] && $server['b']['c_port'] == $adminarray2[6] && $player['name'] == $adminarray3[6]) { $player['name'] = "<font color='blue'>{$server['p'][$key]['name']}</font>"; } //code any help would be greatly appreciated. -Dodge Hi php freaks i am new to php im doin a small project to handle tickets created by customers now i want to change the font color based on the status for example: ID + Name + Product + Status ------------------------------------------------------------------------------------------------------------------------------------ 1111 + abcdef + bat + processing ----------------+--------------------------------------+------------------------------------------+------------------------------ i can connect to database and fetch it the only place i need help is changing the any help would be very helpful thanks in advance This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=349729.0 Hi guys and gals , got a minor problem. I have a table in which i want the "photo" column to have a default value of "noimage.jpg". I set the default value to "noimage.jpg" and put "as defined" too. but when i fill the form in and leave the upload field blank it doesnt show the noimage.jpg as it should and in the mysql table it leaves it blank and not with default value. Here is the inserts.php which adds the data to the mysql table. Can you help please. <CENTER><B>Vehicle Added</B></CENTER> <BR> <?php mysql_connect("localhost", "wormste1_barry", "barry") or die(mysql_error()); mysql_select_db("wormste1_barry") or die(mysql_error()); $CarName = mysql_real_escape_string(trim($_POST['CarName'])); $CarTitle = mysql_real_escape_string(trim($_POST['CarTitle'])); $CarPrice = mysql_real_escape_string(trim($_POST['CarPrice'])); $CarMiles = mysql_real_escape_string(trim($_POST['CarMiles'])); $CarDescription = mysql_real_escape_string(trim($_POST['CarDescription'])); $pic = mysql_real_escape_string(trim($_FILES['uploadedfile']['name'])); $target_path = "images/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; echo "<br />"; } else{ echo "There was an error uploading the file, please try again!"; } mysql_query("INSERT INTO cars (CarName, CarTitle, CarPrice, CarMiles, CarDescription, photo) VALUES('$CarName', '$CarTitle', '$CarPrice', '$CarMiles', '$CarDescription', '$pic' ) ") or die(mysql_error()); echo "The vehicle data has been added!"; ?> In a Switch statement, can you give the Default: a specific name, maybe like this... switch ($resultsCode){ // Missing Primary Key. case 'COMMENT_MISSING_KEYS_2050': echo '<h1>System Error</h1>'; echo '<p>A Fatal Error has occurred. Please contact the System Administrator. (2050)</p>'; break; default 'DEFAULT_CATCHALL_ERROR_CODE_9999': echo '<p>You have reached the catch-all error code... (9999)</p>'; break; Debbie I am loading a link with ajax. When the link pops on the screen and I click it, I get redirected to my 404 page and my lightbox doesn't load. If the link pops in and I refresh my browser, then I click the link my lightbox will show up. How can I do a prevent default on the <a href> in pure JS? No frameworks please. How to define default folder. For example I have folder images and in that folder specific image. In the root directory I have index.php with Code: [Select] <?php require_once("public/includes/header.php"); ?>and in index.php there are links which goes to different folder: Code: [Select] <a href="public/sajt/kategorija.php?id=<?php echo $id; ?>">which also have header.php, but there is no image. How to make default folder for image, or some similar solution? I have a few dropdown forums and would like it to select the current values that are requested. Code: [Select] global $filename,$fileid,$filetype,$filedir,$fileby; global $months,$pg; echo "<h2>Search Files</h2>"; echo "<p>"; echo "<form name = 'File_Search' action = '#' method = 'POST'>"; echo "<table border=\"0\" width=\"100%\"><tr>"; echo "<td>File Name<br><input type = 'text' name = 'name'></td><td>File Type<br><select name = 'type'> <option value = '0'>All Types</option> <option value = 'o'>Official Files</option> <option value = '1'>Quests</option> <option value = '2'>Graphic/Spritesheets</option> <option value = '3'>Entity/Scripts</option> <option value = '4'>Sound/Music</option> <option value = '5'>QuestPack/Programs</option> <option value = '6'>Miscellaneous</option> </select></td>"; echo "<td>Order By<br><select name = 'order'> <option value = '0'>Last Updated</option> <option value = '1'>ID</option> <option value = '2'>Name</option> <option value = '3'>Downloads</option> <option value = '4'>Rating</option> <option value = '5'>Points</option> <option value = '6'>Random</option> </select></td>"; echo "<td>Acending?<br><select name = 'dir'><option value = '0'>False</option><option selected value = '1'>True</option></select></td>"; echo "</tr><tr><td rowspan = '4'><input type = 'submit' name = 'search' value = 'search'></td></tr></table></form>"; echo "</p>"; So if the $filetype equals 2 I want the dropdown box to show "Graphic/Spritesheets" by default. BTW Official Files is not actually a type so that's why I chose to give it a small letter o and will work the same way as All Types but run a different function. $fileby is used for the OrderBy field. $filedir is for the Acending field. The other data is for the other parts of the script. If you like you can give advice on the name's default because you may have a better method then what I have in my head. Hi. I have drop down boxes for date and time that work. The year is a problem because I am using variables instead of fixed values. Code: [Select] <select name="Year" style="width:60px"> <option value="2010" >Test <option value="<?=$ThisYear?>" <? if ($Year == "<?=$ThisYear?>"){?> SELECTED <?}?> ><?=$ThisYear?> <option value="<?=$NextYear?>" <? if ($Year == "<?=$NextYear?>"){?> SELECTED <?}?> ><?=$NextYear?> </select> <select name="Hour" style="width:50px"> <option value="10" <? if ($_SESSION["Hour"] == "10"){?> SELECTED <?}?> >10 <option value="11" <? if ($_SESSION["Hour"] == "11"){?> SELECTED <?}?> >11 <option value="12" <? if ($_SESSION["Hour"] == "12"){?> SELECTED <?}?> >12 <option value="13" <? if ($_SESSION["Hour"] == "13"){?> SELECTED <?}?> >13 <option value="14" <? if ($_SESSION["Hour"] == "14"){?> SELECTED <?}?> >14 <option value="15" <? if ($_SESSION["Hour"] == "15"){?> SELECTED <?}?> >15 <option value="16" <? if ($_SESSION["Hour"] == "16"){?> SELECTED <?}?> >16 <option value="17" <? if ($_SESSION["Hour"] == "17"){?> SELECTED <?}?> >17 <option value="18" <? if ($_SESSION["Hour"] == "18"){?> SELECTED <?}?> >18 <option value="19" <? if ($_SESSION["Hour"] == "19"){?> SELECTED <?}?> >19 <option value="20" <? if ($_SESSION["Hour"] == "20"){?> SELECTED <?}?> >20 </select> however this works Code: [Select] <select name="Year" style="width:60px"> <option value="2010" >Test <option value="<?=$ThisYear?>" <? if ($Year == "2011"){?> SELECTED <?}?> ><?=$ThisYear?> <option value="<?=$NextYear?>" <? if ($Year == "2012"){?> SELECTED <?}?> ><?=$NextYear?> </select> Can anyone help with this please TIA Desmond. I have this code, for an Upload Form, that works successfully renaming and moving an uploaded file to the upload/ folder. How do I set the date format so that it's always going by the UTC date? I've used: Code: [Select] date_default_timezone_set('UTC'); but, when I change my date on my computer, the date changes on the website. This is really confusing me, googled different ways for like 10/20 minutes and can't find anything. If anyone can help it'd be great, Thanks, Andy. I am using this php code <?php echo $_GET['CiFrame']; ?> to check the url for the variable CiFrame, this allows me to link to a page through my page containing the iframe. Here is my iframe code. <iframe name="CiFrame" width="727" height="805" src="<?php echo $_GET['CiFrame']; ?>" scrolling="auto" frameborder="0"></iframe> The problem is that if the url does not contain a variable the iframe will not open a page. How can i set a default variable if one is not provided? Thank You Hi, I am trying to get the date and time that a particular table was last updated, which the code below does, but it doesn't seem to be putting it in the correct timezone, it is 5 hours behind, anyone know why this is? or how i can fix it? Thanks Code: [Select] <?php date_default_timezone_set('Europe/London'); $query = "SELECT UPDATE_TIME FROM information_schema.tables WHERE TABLE_SCHEMA = 'tffdb' AND TABLE_NAME = 'test_team_points'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); echo $row['UPDATE_TIME']; ?> Hello, i know this is a very silly question but it bothers me to know the reasoning behind it. My application has a design where the functions are stored in functions.php and variables are stored in variables.php. There are some functions that have variables that i might change often and the reason i don't directly use them in the argument itself is so that in future if i have to change the default argument's value , then i wouldn't have to scroll through all the functions and look for it. I have a slippery memory i know i will be able to remember it better if i store custom global variables separately and custom global functions separately. I tried searching these forums for this but its giving me a message like "search daemon not found" or something like that.. Anyways , coming to the point, i know that PHP doesn't accept variables as default arguments but may i know the reasoning behind this? If i understand the reasoning behind this i know it will stick better in my head.So..why does a function not allow a variable as a default value? Or if anyone has a link to explaining this behaviour in PHP, i would appreciate it if you could pass it on! Thank you ok this grabs mp3 from 4shared but the download link appears as preview.mp3 how could i get it to be renamed as the original reach name like here_without_you.p3 or something else? Code: [Select] <?php $file = file_get_contents("http://www.4shared.com/audio/PmMMpPFs/here_without_you.htm"); $body = preg_replace("/.*file[^=]*=|\&volume.*/si", "", $file); preg_match("/((ftp)|(http(s?))\:\/\/(([A-z0-9\?\-\:\=\;\.\@\/]+)))/is",$body, $result); $download_url = $result[1]; print_r($download_url); ?> This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=333290.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=356851.0 My 1st try practice uploading file to the server and it was successful. Now I wonder how can I set a default file name to the file that will be uploaded and overwrite the existing one. I have tried experimenting on the code but I can't get it to work. Here's my simple code.. edit_logo.php Code: [Select] <?php <form enctype="multipart/form-data" method="post" action="uploaded_logo.php"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <tr> <td>Choose a Logo to Upload: </td> <td><input name="uploaded_file" type="file" /></td> </tr> <tr> <td> </td> <td><input type="submit" value="Upload File" name="submit>"</td> </tr> </form> ?> uploaded_logo.php Code: [Select] <?php if($_FILES['uploaded_file']["type"] == "image/gif") { $target_path = "logo/"; $target_path = $target_path. basename($_FILES['uploaded_file']['name']); if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $target_path)) { echo "<span class=\"error_validation\">The Logo has been successfully changed!<br></span>"; echo "<span class=\"error_validation\">Upload Logo Again? <a href=\"edit_logo.php\">Click Here</a><br></span>"; } else { echo "<span class=\"error_validation\">There was an error uploading the logo. Pls. try again.<br></span>"; echo "<span class=\"error_validation\">Upload Logo Again? <a href=\"edit_logo.php\">Click Here</a><br></span>"; } } else { echo "<span class=\"error_validation\">Invalid file format. We are only accepting image file. Pls. try again.<br></span>"; echo "<span class=\"error_validation\">Upload Logo Again? <a href=\"edit_logo.php\">Click Here</a><br></span>"; } ?> So what the code suppose to do is.. If I upload an image file as the new logo it should have the default logo name "my_logo.gif", then it will overwrite the existing one... Anyone? Hi I have been trying to get a value to be selected in a mysql populated dropdown list but can't get it to work and was hoping someone could help I have a database with user info in it and this is an update page where they can update their details. The code i have (which doesn't work) is: <select name="agency"> <? $query1 = mysql_query("SELECT * FROM agents ORDER BY agent ASC",$connect); while($myrow = mysql_fetch_assoc($query1)){ $agent = $myrow['agent']; echo "<option"; if ($agent == $agency) { echo "selected='selected'"; } echo ">$agent</option>"; } ?> </select> The $agency value is the current agency which is stored in the users profile and the value does exist in the list which is being populated (also, i have define $agency further up in my code) so i don't know why the selected value won't display. No value is displayed in the dropdown list on the page - but the values are in the list if i remove the selected='selected' part of the code. Any help yould be greatly appreciated. Merry Christmas Andy having a problem figuring out how to change the default on a drop down box to equal the users current timezone. So when they view it the drop box default is showing what their setting is atm. The problem is the value is differant from whats displayed. Is it possible to some how say if users time offset is equal to a option value set selected=""> to yes. if not what is the idea behind this? Cant find a guide showing an example In other drop down boxes where the value is the same as whats displayed I just simply created another value field at the top of the list and echo it in. Code: [Select] <select name="gmt"> <option value="-28800">(GMT -0800) Pacific Time </option> <option value="-25200">(GMT -0700) Mountain Time </option> <option value="-21600">(GMT -0600) Central Time</option> <option value="-18000">(GMT -0500) Eastern Time </option> </select> |