Jump to content

Wickham

Advanced Member
  • Posts

    1,114
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by Wickham

  1. I got there in the end. I used in the form code to show the future date in the full format 14 November 2009 (today + 10 days) The name="date10" in the form creates a variable $date10 $date10 = $_POST['date10']; and then I created a new variable taking the string from date10 in the full format and converting it into a y-m-d format $date = date('y-m-d', strtotime("$date10")); which gets fed to the database $result=MYSQL_QUERY("INSERT INTO my-table (id, place, date, time)". "VALUES ('NULL', '$place', '$date', '$time')") or die ( " Unable to select table "); so the form's proposed future date can now be edited by a viewer and will go into the database (unless he edits it in an incorrect way, of course, but then I have the timestamp in the database as a check).
  2. Thanks for your reply; I haven't had time to try your codes yet; I took the easy way out temporarily by having one bit of PHP for the form input value to calculate the current date plus 10 days in d F Y format so that it shows as 13 November 2009 in the form and then a variable for the MySQL submission which has the same calculation but in the format y-m-d which MySQL can accept. and for the MySQL link (part shown):- $date = date("y-m-d", strtotime('+10 days')); $result=MYSQL_QUERY("INSERT INTO my-table (id, place, date, time)". "VALUES ('NULL', '$place', '$date', '$time')") or die ( " Unable to select table "); The form and the database show the same date (in different formats) but it means that if someone edits the date in the form, the value="..." in the form isn't taken to the database, it's the other variable which I haven't been able to link to the form value yet. I assume that as the form value is echo date() it must be a string, so what I need is a function to convert a string into a different format that I can feed outside the form to a new variable that I can send to MySQL. Every time I change the format inside the form it changes the format of the form display which I don't want.
  3. This is an input tag from a simple form to show a proposed future delivery date:- which shows in the form input box as 12 November 2009 (+10 days from current date) and is in the format I want to display. When submitted to the MySQL database the date is rejected because the database can only accept a date in a format of y-m-d or y/m/d. How can I change the format inside the input tag so that the date is sent to the database in a different format but still keep the form in the format I want? I can code the input tag in the correct format for the database but then the display is not in the format I want. It seems that the value="..." in the form input tag serves two purposes, to display the value in the form and to send the value to the database, so if I format for the display it sends the wrong format to the database; if I try to put two values in the input tag it objects or sends the wrong one to the database. I have thought of having a dummy input tag with display: hidden but can't get it to work yet. Additionally, if the format is y-m-d (which works but I don't want) the viewer can change the date if he doesn't like it and the revised date will go to the database, and I'd like this to happen with my desired format. I may have to put the date outside the form, but then how do I get it into the database?
  4. EDIT - go to my edit at the bottom of the post. No one else has answered so I will offer a little more information, but my PHP and MySQL knowledge is not much; I was hoping falkencreative would answer the question properly. Your page display has this code Date: <?php echo $row_RsEventos['fecha']; ?> which just repeats what is in the database field 'fecha', so perhaps one solution is to change the format in the database, not in the PHP code which displays it on the page. If you look at this example:- http://www.wickham43.net/formphptomysql.php You will see a form for submission of data which has a date already inserted with a date format echo date("d M Y"); ?> and the database stores this as text (Field: Date; Type: text) and the display of the data in the table at the bottom of the page just shows the text of the date that the database stored. You can see from the dates in the display that the format changes half way down because I changed the date format in the top submission form. My Date is stored as text but you probably have the database storing date in a date format. You don't show how you get the dates into the database; either change the date format in the form you use to input into the database or go into the database and change the date format there. MySQL date is always stored in the YYYY-MM-DD format and it's complicated to reformat it so it may be easier to change the database Type to Text and then the PHP for the page should output the same text as the database. Editing the Type for the Field in MySQL is relatively simple and you would then have to edit the previous database entries manually but future date entries as text would be repeated as text by the PHP code. I expect that there is a way to take the date format from the database and change it to another format with PHP for the table display but falkencreative will have to answer that. EDIT: I've been experimenting and this code worked for me:- date('d-m-Y', strtotime($row['fecha'])) but I was testing with a different database and a different form so where you have <?php echo $row_RsEventos['fecha']; ?> in your PHP file I think you need <?php echo date('d-m-Y', strtotime($row['fecha'])); ?> Try it.
  5. All the date codes are here:- http://php.net/manual/en/function.date.php Use d-m-Y for dd-mm-yyyy
  6. You can put PHP includes inside other php includes; but your code doesn't have the include function; perhaps it should be like this:- PHP INCLUDES and footer.inc file has only this:- print $secret_password; ?> then the first page will show the word fish inside the p tags after two php codes. (I haven't followed all the previous posts so I'm just showing how it could work).
  7. Wickham

    Website Help

    I'm not exactly sure what you mean, but you could put the meta tag content like this Company A website in a separate file called, say, titleandmeta.inc and then put this in every page head section instead of the tags <?php include ("titleandmeta.inc"); ?> and rename every main page with a .php filename extension; then you only have to edit the .inc page to change the display.
  8. Wickham

    Date plus 2 days

    Sorry, I'm answering my own post again, I've found a way to do it:- $day2 = mktime(0,0,0,date("m"),date("d")+2,date("Y")); and in the processing part of the PHP:- if($State == "NY") { echo "$FirstName $LastName - we will get back to you within 2 days, ie before " .date("d M Y", $day2); exit; }
  9. Wickham

    Date plus 2 days

    If this is the PHP date format: echo date("d M Y"); how do I add 2 days to the current date? If it's 31 December 2009 I don't want 33 December 2009. Presumably I have to create variables for p and M and Y and add 2 days to d and then check if it goes beyond the month and year somehow.
  10. It's because you have two }} here:- border:none; } /*}delete*/ #mainpicture { background-color: #CC9933; margin: 0px; padding: 0px; height: 150px; width: 100%; background-repeat: repeat-x; }
  11. Well, that's a mystery; I've just tested my code to make sure it works. I don't think the doctypes affect the general principle. You should be able to use one background for the html style and then another in the body style which goes on top. What you've got now with background-color: #E7CCA6; in the body style will just cover up all the html background.
  12. You have two backgrounds in html, that's not possible; use only one for html and one one for body.
  13. This test code works well; it has variables to add up the widths of images and put the total width in a style in the head section style tags to create a width for a div. If the style #pictures2d { width: <?php echo $totalwidth3 . "px"; ?>; height: 90px; } is put in a separate stylesheet the PHP won't connect with the variable in the main page. Is it possible to use a session to connect the stylesheet with the main page? $image1_width = "435"; $image2_width = "90"; $totalwidth3 = 30+$image1_width+30+$image2_width+30+$image1_width+30+$image2_width+30+$image1_width+30; ?> <br />img { margin-right: 30px; padding: 0; }<br />img.first { margin-left: 30px; }<br />.pictures1 { width: 500px; border: 2px solid green; overflow: auto; height: 100px; }<br />#pictures2d { width: <?php echo $totalwidth3 . "px"; ?>; height: 90px; }<br /> alt="image 2"> alt="image 2"> I've tried putting all the php code with the variables in the stylesheet with the styles and renaming the stylesheet with a .php extension but it doesn't work. EDIT: I've answered my own question - I put all the php variables and styles in a separate file called style1.php (having added the style tags either side of the styles) so that the variables are in the same file as the style that uses one and used a PHP "include" in the main php file instead of a css file link. It does get all the styles out of the main page, but in an include file instead of a css file.
  14. Ben's gradient image will produce a gradual change from one color to the other over the length or width of the image (whichever direction you have chosen to make it). The site you give a link to has used a huge image 2000*1600px because it has a gradient in two directions, so you can't repeat it in one direction:- http://www.webvanta.com/img/background_main.jpg If you want two completely different colors as a background, use two images which are both repeat-x. If you want the color to change 300px down the window, make the first image say 1px*300px and the second say 1px*500px high as a total of 800px height should cover most window resolutions. Then put one as a background on the html style and the other on the body style:- CSS html {background: url{blue.jpg) 0 0 repeat-x; } body { background: url(green.jpg) 0 300px repeat-x; margin: 0; } where 300px is the vertical position where the image starts. Repeat-x will repeat the 1px width horizontally. Margin: 0; will get rid of the default side , top and bottom margins around the window.
  15. You can use all left classes or all right classes or a mixture. If the container is wider than all the nested divs, then a right class can create a space between it and a left class on its left. If the container exactly equals the total of the nested divs then it doesn't matter which you use. If you add borders, remember that they add to the div width so you will probably have to increase the container width or reduce a nested div width. I used the same style in each row, but you can of course use different class names, especially if they are different widths in each row or have different backgrounds.
  16. Padding and borders used to be a problem in versions of IE but not if you use a doctype right at the top of your html page, before the tag. We suggest HTML 4.01 Strict on this forum:- http://www.w3.org/QA/2002/04/valid-dtd-list.html or the transitional in some cases where elements are deprecated (old and being phased out). A doctype means that margins, padding and borders will be outside the element's (like a div's)basic size for all browsers whereas without a doctype IE will calculate padding and borders inside the basic size. Start the right way and use divs, then use margins and/or padding to keep them apart. All div boxes on one row need either float: left; or float: right; Between the rows put a nil-height invisible "clear" div to clear the floats above to start a new row. CSS:- #container { width: 860px; margin: auto; } .clear { clear: both; width: 100%; height: 0; visibility: hidden; } .left { float: left; width: 250px; margin: 5px 10px; } /*top & bottom 5px, sides 10px*/ .right { float: right; width: 300px; margin: 0 10px; } Markup:- .......... .......... .......... .......... .......... .......... Put all of the markup in a containing div with a width sufficient for all the inner divs if you wish but it's not essential. The margin: auto; will center it in large window resolutions.
  17. I've edited just a few sections, images where I've put in a top margin in px (the order is top right bottom left), deleted all the tags, then put the following text in a p tag with clear: both; to clear the float of the image above and stop it going into any available space beside an image (you should make a class and put clear: both; in a stylesheet preferably):- src="http://www.mikemonaghan.co.uk/mmblog/http:/www.mikemonagh an.co.uk/mmblog/images/2009-09/P010909_21.33%5B01%5D.JPG" class="mt-image-left" style="margin: 30px 20px 20px 0pt; float: left;" height="486" width="648" /> src="http://www.mikemonaghan.co.uk/mmblog/http:/www.mikemonagh an.co.uk/mmblog/images/2009-09/P010909_21.34%5B02%5D.JPG" class="mt-image-left" style="margin: 30px 20px 20px 0pt; float: left;" height="648" width="486" /> ...then on Thursday a journey to Cardiff to hang out with href="http://mattrobertsblog.tumblr.com/">Beautiful Matt and href="http://crazyorgan.blogspot.com/">Jon. We went to see Man Without Country... src="http://www.mikemonaghan.co.uk/mmblog/http:/www.mikemonagh an.co.uk/mmblog/images/2009-09/P040909_18.17.JPG" class="mt-image-left" style="margin: 30px 20px 20px 0pt; float: left;" height="480" width="640" /> src="http://www.mikemonaghan.co.uk/mmblog/http:/www.mikemonagh an.co.uk/mmblog/images/2009-09/P040909_18.14.JPG" class="mt-image-left" style="margin: 30px 20px 20px 0pt; float: left;" height="480" width="640" /> src="http://www.mikemonaghan.co.uk/mmblog/http:/www.mikemonagh an.co.uk/mmblog/images/2009-09/P040909_20.39.JPG" class="mt-image-left" style="margin: 30px 20px 20px 0pt; float: left;" height="640" width="480" /> ... on Saturday we headed to Nottingham to celebrate my mothers' 60th Birthday! Tested in IE7 and Firefox OK.
  18. That's OK now in IE6, IE7 and Firefox; in fact you have space to spare because the total width of the classes is 476px plus 6*2*12px padding = 144 = total 620px. You probably don't need the width: 80px in #navInner li now because #navInner li has the float: left and the classes have the widths.
  19. Yes, I know exactly what you mean. It's all because IE6 won't work without a width, so what I sometimes do is to create several classes all with different widths for each menu item, making sure the total plus padding, margins, borders does not exceed the available width (664px for #nav). Then you can size them to suit the text width.
  20. No it doesn't interfere but unless you allow room, the nav items will slide under or over the logo. In IE7 and Firefox the menu titles appear closer together because the li tag has no width,, so the 15px side padding is from the edges of the text like HOME which is short, but IE6 needs a width with the float, so you need to give the li tag a width, either the same for all or individually with a class or you could leave the styles the same for IE7 and Firefox and include a conditional comment making different padding with a width just for IE6. Because IE6 needs a width for the li tag, I had to work out what was available on the right of the logo and make them fit, rather than just allowing each one to have its text width plus side padding..
  21. Well, it's on the left of the #nav so you have to allow for it, don't you?
  22. Your navbar with six items is not displaying horizontally in IE6. Your #headerinner is 900px wide. Your #bloomslogo div is 220 + 16 = 236px wide, leaving 664px for the #nav. Each #navinner li style has 15px right and left padding x 6 = 180px leaving 484px for the actual li tags / 6 = 80px each and IE6 needs a width when there is a float, so I edited:- #nav { color: #4C4D4F; font-family: Helvetica, Arial, sans-serif; font-weight: normal; position: absolute; right: 0px; width: 664px;/*618px;*/ bottom: 0px; } #navInner { } #navInner ul { list-style-type: none; } #navInner li { width: 80px; display: block; float: left; height: 24px; text-align: center; padding-top: 5px; padding-right: 15px; padding-left: 15px; } which makes IE6, IE7 and Firefox display the same but the 80px is not enough for the width of the longer titles like REVISION COURSES so I suggest you increase the width of #navinner li and decrease the padding-right and padding-left.
  23. This is just a guess, but might be worth a try. Special characters like ? are often unrecognised and you have to use the character code in html which is £ for ? but although this will work in text I'm not sure if it will affect the PHP processing. I also believe that the PHP encoding needs to be utf-8 and not iso-8859-1. I think one solution is not to use ? in a variable like $?amount just use $amount and put the ? sign as £ in a text string like $current_prices = array("Bed"=>"£200.00", "Chair"=>"£100.30", "Table"=>"£450.00"); as this doesn't work:- $current_prices_in_£ = array("Bed"=>"£200.00", "Chair"=>"£100.30", "Table"=>"£450.00");
  24. It looks as if you may need to change your hosting service. Check the emails or letters you got when you signed up; it should mention how many email addresses, domain names, sub-domains, parked domains, databases (if any), upload/download limits it allows and also programs like PHP that it supports.
  25. If the web company inherited the website from another company and not from your company, then it belongs to them, I imagine. The only proviso is that if your company paid for the original website design, then look at the original contract as it might be that you bought the copyright despite what the notes say.
×
×
  • Create New...