Jump to content

Jodha

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by Jodha

  1. Solved! Funny what a cuppa tea and a fag break can achieve. I needed to add a row to my content table which refers to the form processing .php file. Next, the "action='...'" section needs to be (as I tried before adding the relevant row in my content table) action='index.php?action="the reference to the form processing file, as per content table"' With the amendment to the content table I have the functionality that I want
  2. Hi All, Been up to some interesting things, now got a website shell well on its way to fully communicating with its website db. Got a posting form question, hope you can help My 'page display' is thus: header at top; menu at left; content (as per navigation) on the right; footer at bottom. Currently I have some forms appearing in the 'content' area of my 'page display'. When I hit 'submit' on my form the processing script .php file replaces my entire (previously described) 'page display'. I.E. I loose header, menu and footer, and only see what I echo on the form processing .php file. On the "<form... action='.....'>" part of the start tag for my form, is there a way of making the form processing .php file appear in my content area (as oppose to replacing my whole 'page display')? I have tried various variations of link within the ''s of action='...', but to no avail. - this includes index.php?action='blah' Currently the 'page display' builds by constructing a table via echo, and in each cell in the table I am using an include ('xxx.php'); command to display the section I want. In the content area the section in the parenthesis is a variable, which allows different .php files to be loaded into my content section. This has been faultless using normal <a href...> type links. IE for "home" my URL = website/index.php?action=home for "add text" my URL = website/index.php?action=add_text But when I process the add text form the URL = website/"the directory the processing form is in"/add_text_exe.php Hmmm... any thoughts?
  3. Sorted: Below the query script I need to include the following - $row = mysqli_fetch_assoc($result); $max_'variable name' = $row[0]] echo $max_'variable name' I can now see my maximum variable number as $max_'variable name', thus can use $max_'variable name' is other parts of my code where I need to. I knew it would be quite simple in terms of some additional code with correct syntax after the initial query. I've now got this working to pull two max variable values out of my table The rest of my code should be easy now I have obtained two maximums I needed
  4. OK, I've looked at the link provided, it looks like it refers to something else I am already doing elsewhere which I am fine on. In MyphpAdmin I type this: SELECT MAX(column) FROM table I get my magic number 'X', I know the SQL query works. In my script I am currently trying: _________________________________________________________ $cnx = connections variables, all present and correct $query = "SELECT MAX(column) FROM table"; $result = mysqli_query($cnx.$query) or die ("die statement"); $row = mysqli_fetch_[ row/assoc/array - same output for any ]($result); echo $row _________________________________________________________ I echo $row so I can see if it agrees with the number I obtain from the direct SQL query typed into MyphpADMIN. All I see displayed is "Array". - Using the actual table column name as a variable displays nothing - Using the actual table column name without a $ displays the column name, not max number. __________________________________________________________ From other experiments I am pretty sure I can obtain the highest value in a column on a table, and just display it in a couple of code lines following the query. Using 'while' statements seem to be more relevant to when I am waling through the content of a table, displaying items from each row and I go through each row. I can do this aspect no probs Thoughts anybody?
  5. Cool, Actually a mate's just called with similar solution: code: $query = "SELECT MAX(column) FROM table"; $depth = myqsli($cnx,$query) or die ("die message"); But echo $depth; displays "Catchable fatal error: object of my class mysqli_result could not be converted to a string on 'line reference of code'" plus I am getting the same message which ever way I go about this now. Assuming highest value is '5' I could do with $depth = 5, or what ever it gets set to in the db...
  6. Hi! Assume I've queried a database and obtain values from column 'X'. This only contains numbers. Can I obtain a variable which will equal the highest number in that column? I can only find info on how to add all the column numbers, select rows for certain number values, or list all the column numbers, sorted or unsorted Quite happy with that, just want to be able to extract the highest number from the selection ??? Help muchly appreciated
  7. Hmmmm, handy tip. Good to see your sig amended too
  8. By the way Blade280891, sorry to be pedantic but in your signature it should be: "the other 0.1% means you asked the wrong question" You are out be one decimal point
  9. I thought so, my apologies there. Haven't had such probs to this degree with column widths when the page is HTML, so just thought there might be a little PHP trick involved there Maybe IE should be taken out Fight Club style, I figure this must be one of the most annoying aspects of webdev - your site looks cool on all browsers but the browser which happens to be shipped with the most used OS. Dam them MicroSoft peeps (sorry if thats you!)
  10. Hi, sorry if this is inappropriate to ask here, shoot me down if so I am using "echo" to display a table if which the left column MUST be 200 pixels wide, and no more for proper presentation. In my code I have: echo "<tr> <td width ='200' align='left' valign='top'>"; include(.....); echo "</td> <td>"; include(.....); echo "</td> </tr>"; (please excuse silly typos - reading from laptop and posting from desktop compys, plus food has just been dished up! In Firefox the left column width is 100% perfect In IE the column width seems to be ignored, and the browser just does what it wants, something its most of the page wide, sometimes just some. Does anybody know why IE behaves inconsistently and is there a trick to make it perform like Firefox? Cheers me mateys
  11. Hi GURAQTINVU, All problems solved (see other thread on same subject), further up the learning curve, and much happier Getting there Still a lot of other stuff to learn, but I now know enough to build my current site project. Once done, I can turn attention back to the books and get to grips with other aspects. Enjoying the learning, just get frustrated (maybe a little too easily) when what should be a simple answer doesn't show its self clearly... but that might be compounded by me not always knowing what I am actually looking for
  12. SUCCESS Applying the code which thorpe provided in the his last post has solved all my current problems with this site design. I can use my expanding menu, use the linking and variable value adjusting code as suggested, and my provisional template if giving my correct test results. All I need to do now is get the frick on with the job Thorpe, I am very grateful. If you where local I'd take you out for a pint. In absence of this, I hope this will do until a such time when I can buy you a pint:
  13. I am semi-familiar with $POST but not yet used $GET, there is a bunch of text the contraversally writing Janet Valade has in her book, I shall reread shortly. I'm well aware of case sensitivity, but thanks for the double check I like uniformity in code otherwise its easy to loose yourself innit!
  14. Errant_Shadow and thorpe, I do believe you have provided me with my holy grail, thank yee both very muchly Looks like I have both options to work with, so my day looks like I should get it rolling and get coding Thorpe, if I missed your previous reference it's probably because I have been looking out for <a href... and I dont think you have mentioned that in your previous post, you spoke of other code statements. I would imagine my lesser knowledge stops me from connecting the two. Sorry for making you type things out again, however, your second post is very clear to me. I take my hat off to you for that I also see your point about bookmarks, however I was more thinking about it from site security... if the viewer is getting less info on how you have your directories (etc) it'll be harder for them to hack. Although I suspect a serious hacker would still find it kids play. I normally like to produce sites so the navigation side of things means you dont 'have' to book mark a page as such, you just go to the site and all pages are so easy to get to you can ask the question, why bookmark this single page when it is one click from your menu? ...guess I'm not thinking as if I had a photo album with hundreds of sub pages however. Maybe I'll revise my practises. Anyways, many thanks again. Hopefully I'll not need come back for more help on this, but assuming wind is now in sail I'll let you know successful I've been Cheer!
  15. Hmmm, it will I'm sure, but I dont think I still have an answer to what I am actually trying to achieve right here right now. However, before saying any more I would like to thank everybody who has provided advice and guidance thus far. Now, let me try and provide a full rundown of my project, which should show why the good advice so far doesn't actually help me that much. Or at least, why I am not interpreting is correctly. 1) I want an index.php file which is the website portal. I've done this with HTML and framesets where the frameset is the portal. I dont like sites which fill the address bar with loads of stuff, I like to keep what it shows simple. I.E. "http://www.thewebsite.com". I find any "/index.php" or "/index.html" gets truncated the way I do this, which I also like. I think this may be browser dependent, but thats by the by 2) At the top I want a header. 3) On the left side I want the navigation function. My 'client' (friend in need to website) has specified a particular menu system I have in HTML code using CSS and JS. 4) To the right of the menu I want the content to be displayed. This changes as per menu item selection. 5) At the bottom I want the footer. My index.php (template) is currently coded thus: header.inc and footer.inc you dont need to know about. They contain details of my client's business and we are both satisfied with the way these display and their content. $content is a variable I wish to use for selecting what is displayed in the main part of the site. As the variable changes, different pages are displayed, (ahem) obviously! I know how I can combine aspects within a variable from other variables or just plain adding in extra bits of string to turn say $content = home to $content = home.inc or $content = content/home.inc etc. The issue is with these dam <a href=content.html>Content</a> aspects in the menu script. The menu script (disregarding the CSS and JS) looks like this: Now, what is the PHP statement which needs to follow "<a href=" to change this from a normal HTML link tag to a statement which changes the value of $content? That is my one and only question I want an answer to. I dont want links to websites where I have to wade through a bunch of text to try and find the answer, I've been doing this to no avail, which is WHY I come to a forum of PHP heads to directly ask people who know this language better than me. Lets assume somebody knows, please tell me Assuming there is no statement for this (I am happy to accept this as a possibility), the other way I figure I can do this is: - repeat the script I have already described but in a way which sections index.php into its (what will be about 50) sections of content and the <a href=content.html>Content</a> statements take you to each section. Something like - <a href=index.php?action=content>Content</a> Using this, for each section I'll use an "include(content.inc)" statement instead of the $content variable. Seems longer winded but I still get what I want. It'll mostly be a cut'n'paste operation anyway. For this option, I need to know two statements: 1) The statement which starts each block of code for each section 2) The statement which ends each block of code for each section I'm sorry if this has already been answered, but I cannot see the answer clearly in what has been returned so far if this is the case. As for connecting to a database, for the above I dont want to get into that. I will be using a database for displaying sections of content such as the CVs and the information guides my client needs to display on his site. I am already versed enough with such database interaction to achieve this happily -> one of my personal projects was building an events listing application for my website which is database driven, I've got it referencing flyer images and formatting dates, times and prices plus a "publish this event" option and an update information function. My stumbling blocks are taking my previously used library of HTML menus and implementing them in PHP script, similar to how I describe above. If no advice can be provided to answer this (hopefully simple issue) I'll just have to jump back to using framesets in HTML to get the site presentation how it has been briefed. Many thanks in advance for further help, I dearly hope somebody understands what I am trying to do and provides the right guidance. Best regards all
  16. The Link: Well, dunno, just tried it again... does BB code work here? Lets try Could it be my version of FireFox? Could it be the route through the net my computer takes to get to this particular server? 1) Coding dont make me mad, I enjoy it otherwise I wouldn't be trying to advance onto more than HTML. Back in '82 when the speccy came out, me bro would play Horrace Goes Skiing and Chequered Flag, I picked up the manual and taught myself Basic. Lost interest in computers when Sinclair took the commands off the keys and you had to type everything, got a bike instead and took up mountain biking. Then discoverd clubbing, got into DJing, from there into music production, and from music production using CuBase (kinda programming but with organising sounds and signal routing) found myself back at playing with other sorts of media including basic website production. I like creativity, website coding is creative. What makes me mad is when there is a simple thing which alludes me which I would be happy to pass on to another, but find it hard for the reverse to happen. Knowledge is there to be shared, not horded 2) Maybe it was answered twice in the other post, but in a way I am not understanding. Just as my book (PHP & MySQL for Dummies) assumes you already know HTML and doesn't explain it there, I may be right in thinking you beleive my level of PHP knowledge is higher than it actually is. Its not that I dont have the capacity, I just aint had enough of the experience innit. 3) Amazon reviews of the book are mixed actually, take a look: http://www.amazon.com/review/product/0470096004/ref=cm_cr_dp_all_helpful?_encoding=UTF8&coliid=&showViewpoints=1&colid=&sortBy=bySubmissionDateDescending I'll hightlight: "p.s.: Janet Valade has written several beginner books on PHP/MySQL. Maybe, eventually, she will get it right. She is so close... " I've also read somewhere, she likes to throw in little 'mistakes' to test the reader. Personally, if I buy a text book I want the whole and actual truth of the text which it is about, especially if I am learning something new of which I have no prior knowledge. I'm sure you would all concur. If I where to write a text book to teach others, this is the approach I would take too. Why write a text book if you are only going to throw your students off what they should be learning by leaving in mistakes? Bad practice. Found all this out after the book was bought. I might be up for that 100 dollar bet
  17. So, let me see if I understand this - Lets say I have PageX, Page Y, Page Ya, Page Yb, Page Yc, Page Z. On all pages I want the same Header, Menu and Footer. I code the index.php file with the following way: Includes = include(header.html); include(menu.html); include(footer.html); include(PageX.html; include(PageY.html); include(PageYa.html); include(PageYb.html); include(PageYc.html); include(PageZ.html); I have these in a 3 row table, Header & Footer at top and bottom across entire page width. Middle row is split into two columns, left side is Menu, right column is content, as per: PageX PageY PageYa PageYb PageYc PageZ Lets call this entire arrangement of Header, Menu and Footer plus content page "Display Table", or more specifically "Display Table with Page X" (for example). In the menu the <a href="blah">blah</a>'s become <a href="index.php?PageX=">PageX</a> <a href="index.php?PageY=">PageY</a> <a href="index.php?PageYa=">PageYa</a> <a href="index.php?PageYb=">PageYb</a> <a href="index.php?PageYc=">PageYc</a> <a href="index.php?PageZ=">PageZ</a> As I run down index.php I code it thus? <?php $string = $_GET['page']; switch ($string) { case "PageY": "Display Table with Page Y" break; case "PageYa": "Display Table with Page Ya" break; case "PageYb": "Display Table with Page Yb" break; case "PageYc": "Display Table with Page Yc" break; case "PageZ": "Display Table with Page Z" break; default: "Display Table with Page X" } ?> You're probably getting a bit tired of me by now, but confirmation or denial + "here's what's wrong" would be handy. Thanks
  18. Right. lordshoa and kittrellbj are supplying useful info again on my other thread. Respect to you two, and thanks for your patients and ongoing suggestions. This is what good passing of knowledge is about, and its the way you inspire people learning from you.
  19. Well, sorry, all I want to know is a line of standard code. I've been banging my head against a book which is suppose to tell me what to do and it isn't, I get supplied a link which doesn't work. The title of this forum is PHP Help. I'm a newbie, I need help. I'm not code illiterate but PHP is a new language for me, my background is HTML. I'm trying to progress my skills, I know what I want to achieve and I know the answer should be quite simple. Whats wrong with a: "Hey, just start your block with XXXXXXX and you'll be away. The link to that will by filename.php?action=XXXXXXX" To be honest, if I knew the answer and somebody asked me the question, I'd give them the answer straight up, no "go look at this link" and supply a broken link. I gave up on the other thread cos that was going nowhere. There seemed to be a dialogue start, a dialogue needs to continue for a solution to be found. If you cannot take time to talk to newbies and guide them through, how is the PHP community going to grow? All in all, many thanks PHP Help forum for your Help, it has helped me kill half a day on the internet getting nowhere much. kittrellbj, I'll take another look at your post, I'm trying to solve my problem from a different angle here so hopefully I'll see how your original suggestion fits in. The problem was first time round, it didn't look like it would fit into the menu script I need to use. Sorry and best regards to those I am not offending.
  20. dennismonsewicz: Thanks but your link is broken Sudden: Great but thats not answering. I have a book which is supposed to give me this info, they even have example code to cut and paste, it doesn't seem to work, but a lot of other functions I have learned from the book do. Can somebody please just tell me: If you want your php webpage link to navigate to a particular section you need to code: Such and Such PHP statement. Many many many thanks
  21. Hi All, I want to reference different sections within my index.php file. I know there is a way of doing this but I dont have this clearly explained in my PHP book. I's like to know two things which will help me solve a problem I've been puzzling over. Should be easier to answer than my previous posted question which seemed to cause confusion on all sides. I have a link, lets call it <a href="index.php?action=sectionX>Click me for Section X</a> 1) What code to I need to place at the top of the block of code which executes displaying "Section X"? 2) Do I use "break;" to end that part of the code before the next section (say index.php?action=sectionY for argument's sake) This seems to be something to do with the Switch command, but honestly, the example Switch code and explanation in my book just aint giving me results. Many thanks
  22. Using a switch sounds like what kittrellbj suggests. My understanding of switch is limited, I tried an experiment with this a few days ago but didn't get very far. I know on some PHP sites the URL in the address bar changes from http://www.mysite.com/index.php to http://www.mysite.com/index.php?action=something This was what I was trying to achieve the other day, but was not entirely successful; syntax problems which although following the code stated one of the books I have still occured. Double and triple checked the code for typos, no avail. As I understand it, the index.php (or any PHP file) can be sectioned and the content changes as per which section is executed, correlated to the "?action=something". Problems I seem to come across here is: 1) How do I identify each subsection of the code to the respective "?action=something" (the identifying piece of code at top of each code subsection)? There is a line of PHP which heads each subsection, the syntax is not clear to me but I expect its easy to understand and implement. 2) How do I make a link which executes the desired subsection? Further to this, can my current <a href... statements point to these subsections? If so, whats the syntax within the <a href... statement, something like <a href="index.php?action=links">links</a> ? This would make sense to me, if true, the stumbling block is just heading each subsection correctly. Which half of what I say does not make sense to you? I'll try and explain better for you
  23. Lordshoa, you probably have a good point in regard to my PHP knowledge as I am very much only just starting to learn. But so far I have successfully - assigned variables - changed variable values in regard to changing conditions (how many times through a loop/what has been selected from drop-down lists, etc - combined variables to create new variables - used loops - use if statements and variables in loops to discount items within a database (or other info source) from display - used include(); statements to retrieve content of other files - used sql queries to acquire data from databases - echo statements to display a reasonable host of different page elements - code forms to insert data into a database From what I know I can create an index.php file which includes elements using the "include();" statement. This I have done. From what I think I believe it should not be hard to alter an <a href... statement to change a PHP variable, INSTEAD OF LINKING TO ANOTHER WEB PAGE ( sorry for the capital letters ) In my index.php file I have PHP echoing the table layout as oppose to creating an HTML file, it contains my page elements in it where I want them I have an HTML/JS menu script I want to use (listed above) in the index.php layout (also listed above) Lets take the middle (problem) row - Left hand side = HTML menu with <a href... type links Right hand side = include(); statement I want/need to use this menu script but I have to alter it so it changes a PHP variable instead of linking directly to another page. The value of the variable will be displayed in an include() statement, so, when on (and only on) index.php you have - Top, full width of page: Header always at the top, content defined in another file and included using include(header.html): - this is done Middle, left: My menu script with collapsible panels where there are sub-menus, standard <a href... links including code to change the value of (for augments sake) $content, **instead of** linking to another page Just need to know how (if possible) to modify the <a href... statements to change the value of $content instead of providing a link. Middle, right: include($content); Bottom, full width of page: Footer always at the bottom, content defined in another file and included using include(footer.html): - this is done Premise - * I want the website visitor to only ever be displayed one page (index.php) * Within index.php I want the middle right section to be dynamic, as per the visitor's selection from the menu on the left of the page I can build this in HTML using framesets and all the code I currently have. Easy. But I want to impliment this as PHP so I can use my other knowledge to build in content management functions. References to .html files will ultimately be .php or .inc files once I have template working. I just want to know what the underlined section in: <a href="some_page.html">menu item text</a> needs to become so that the value of $content becomes something new each time the visitor selects a new menu item. Such as: <a href=<?php $content=links ?>>link</a> Sorry if that was a rant, like I say, I'm impressed with the fact there are people here trying to help and advise, I'm sorry if I am too much of a newbie to be at grips with some of the things you are saying.
  24. Its more of a case of making <a href= ~set a new value for a PHP variable~ > the menu item title </a> Thus in another part of the index.php this "<a href=" set variable is used to adjust what include( ~the <a href= set variable~); displays. One question which can bring this to closure - Is there a short line of PHP code, for changing a variable value, which can be inserted (represented by "PHP HERE") into an <a href=....></a>, thus: <a href="PHP HERE">My menu item</a> If there is no such code snippit which will work I am going to have to give up on this for now and will resort back to HTML and framesets. Not meaning to sound harsh, just need to get on with this project pronto. I have been impressed with people's willingness to offer advice and guidance :) :) it just hasn't seemed to answer the question I am asking so far ???
  25. Hmmm.. interesting. That looks useful but I dont think it's quite what is required. It's probably useful if I post the menu script for you: <d1 id="menu"> <dt onclick="javascript:menu();"><a href="#">Home</a></dt> <dt onclick="javascript:menu('');"><a href="#">Section #2</a></dt> <dt onclick="javascript:menu('smenu1');">Section #3</dt> <dd id="smenu1"><ul> <li><a href="#">Section #3.1</a></li> <li><a href="#">Section #3.2</a></li> <li><a href="#">Section #3.3</a></li> <li><a href="#">Section #3.4</a></li> <li><a href="#">Section #3.5</a></li> <li><a href="#">Section #3.6</a></li> <li><a href="#">Section #3.7</a></li> <li><a href="#">Section #3.8</a></li> <li><a href="#">Section #3.9</a></li> <li><a href="#">Section #3.10</a></li> <li><a href="#">District Councils Conferences</a></li></ul></dd> <dt onclick="javascript:menu('smenu2');">Section #4</dt> <dd id="smenu2"><ul> <li><a href="#">Section #4.1</a></li> <li><a href="#">Section #4.2</a></li> <li><a href="#">Section #4.3</a></li> <li><a href="#">Section #4.4</a></li></ul></dd> <dt onclick="javascript:menu();"><a href="#">Section #5</a></dt> <dt onclick="javascript:menu();"><a href="#">Section #6</a></dt> </d1> Where there are no sub menus you just link to the page. Where there are submenus the open when you click on the main header and then you see a panel with all the actual links within. Click on another section and this panel will collapse again, showing a new panel if its a section where there is a submenu, etc. Now, if I stick with purely a HTML based website I can do this easily but I will be using frames, and I will be creating an individual html page for each menu item. I want to move away from using html and framesets, but in this case my brief is to use this menu script as this is what my 'client' (friend in need of a website for his business quick) wants to see on his website. Bear in mind I have only included a cut-down version of this menu script, there are many more sections and sub sections! Sorry to be ott, but is there not a simple line of PHP code I can insert into the <a href=" *required PHP code* ">text</a> section within this script which will allow the variable for the include(body.html); to change as per click on menu item? By the way, many thanks so far people
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.