Jump to content

psi-phy

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

psi-phy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you both, however I had to go another route because I really don't get regex and Shogun's approach didn't work. (I can only guess the problem was that the input text file was not accurate with the spacing and such and didn't conform to the Expression that Shogun gave me to use.  :) ) To resolve the problem, I tried some search-and-replace and added a <!--break--> where I needed one.  So I just exploded the file with that. I, however, have run into another problem.  Each line of that file was an answer to a question on a form.  It eventually came down to this: [code] <tr>   <td>Question A</td> </tr> <tr>   <td> (radio button) $alphanum $option $parenthesis</td>  //Answer 1 for Question A   <td> (radio button) $alphanum $option $parenthesis</td>  //Answer 2 for Question A   <td> (radio button) $alphanum $option $parenthesis</td>  //Answer 3 for Question A   <td> (radio button) $alphanum $option $parenthesis</td>  //Answer 4 for Question A </tr> <tr>   <td>Question B</td> </tr> <tr>   <td> (radio button) $alphanum $option $parenthesis</td>  //Answer 1 for Question B   <td> (radio button) $alphanum $option $parenthesis</td>  //Answer 2 for Question B   <td> (radio button) $alphanum $option $parenthesis</td>  //Answer 3 for Question B   <td> (radio button) $alphanum $option $parenthesis</td>  //Answer 4 for Question B </tr> [/code] So all this is in a form, there are A through U amount of questions.  On the receiving end of the form submit, I wanted to have a quick screen to confirm the answers.  This is that code: [code] //  This array is a list of all the question letters from the form up there $questions = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U"); //  This was my lame hack to check that ALL radio buttons actually HAD a value, if not it errored out. for ($i=0; $i < count($_POST); $i++) { for ($i=0; $i < count($questions); $i++) { if (!array_key_exists($questions[$i], $_POST)) { echo "<font class=\"largebold\">ERROR: </font><br />"; echo "<font class=\"warning\">Question " . $questions[$i] ." was not answered.  "._CLICKBACK."</font>"; exit; } } } ?> //  This is the table of confirmation for the data. <table align="center" border="1" cellspacing="0" cellpadding="0" width="20%"> <? for ($i=0; $i < count($questions); $i++) { echo "<tr>"; echo "<td align=center class=bold width=50%>"; echo $questions[$i]; echo "</td>"; echo "<td align=center class=normal width=50%>"; echo $_POST[$i]; echo "</td>"; echo "</tr>"; } ?> [/code] Now up there, you may have noticed the " $_POST[$i] " in the table.  I assume you could traverse a global variable like that as if you could traverse any other array.  So then I tried to "trick" it, by adding a "  $answers = $_POST;  " before the table, which did nothing. So how do I traverse the $_POST variable so it gives me the values of each $_POST key?
  2. Greetings all!   I have a file that is plain TXT but I need to add some HTML/PHP tags to it because it's a form that I am converting for a web-based form.  Now I figured out how to fopen a file and explode each line.  That I get.  What I would like to be able to do is separate the LINE now into three parts.   I have a sneaky suspicion that regex is needed, however I wouldn't have the first clue how to start. Here is an example of what I need to do: [code] $line = A. Option (quick explanation in parentheses) // In that line, it always starts with either a capital letter followed by a period, or a number followed by a period. // Secondly there would be the main Option // Thirdly there is the explanation which is ALWAYS in the ()'s [/code] So I need to explode $line, but how do I break it up just the way I need?  The outcome is so I have three variables:  $alphanum, $option, $paras I want to put the three variables into a foreach loop (taking each exploded line) so it would look like this: [code] <tr>     <td class="normal">$alphanum</td>     <td class="normal"><strong>$option</strong> (<em>$paras</em>)</td> </tr> [/code] I know this is wackey and (for me) seemily horrendously complicated, however any help would be VERY appreciated! :)
  3. Greetings all! I decided to get ambitious with a problem I was having. I, much like some of you most likely, read Digg.com regularly each day. I also tend to do a lot of news reading on my PDA, and Digg's interface is YUCK under a PDA. Long story short, I was customizing the RSS feed for viewing on the PDA screen. I have been wanting to learn the Zend Framework so I chose this for that task as it has a whole module just for RSS feeds. The problem that I am getting is that I get this error: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Fatal error: Class 'DOMDocument' not found in /usr/lib/php/ZendFramework-0.1.3/library/Zend/Feed/Abstract.php on line 87 [/quote] I obviously have the framework in my include path, however what is weird is that the page works fine on my laptop which is XP MCE, IIS 5.1 and the most recent PHP (cuz I just updated it like 2 days ago). The server I am having troubles with is a Mandriva 2006 server, with Apache 2 & php 5.0.4. I did a quick "rpm -qa | grep xml" and came up with this: libxml2-devel-2.6.21-3mdk php-xml-5.0.4-1mdk libxmlrpc0-0.51-7mdk libxml2-python-2.6.21-3mdk php-xmlrpc-5.0.4-1mdk libxml2-2.6.21-3mdk libxml1-1.8.17-8mdk Any thoughts on why this error would come up?
  4. THANK YOU! That's excatly what I needed. I can do PHP, but unfortunately Javascript is something that completely confuses me, and I'm not too familiar with it. I appreciate the help from everyone! :)
  5. Yeah I just tried that, and it works, however i realized that I was using ONE form to try to do TWO different things. The hidden fields I made contain commands for which function to load when the page is submitted depending on which link is clicked. The problem is that when it submits, I get BOTH function commands as all the data is in one form. :\ I have a hidden="edit" and a hidden="delete" but they are "in the same form" so both values are submitted and it doesn't work properly. :( God this sucks :p hehe
  6. Design wise, a submit button would make it look ugly. :) I was hypothesissing this one.. If there is a javascript form submit function, could I just go like this: [code] <a href="index.php?op=whatever&var1=value&var2=value" onclick="javascript:formsubmit()">Edit</a> [/code] See I wanted to pass data with the link as well, so I pass data in the link and I also need to submit the textbox as well... I know it's an odd request, but my big complaint is that the submit button is freakig ugly. :)
  7. OK I have a wackey question. Is it possible to submit form data WITHOUT using Javascript or a Submit Button? I have a page with a text box. To the right of it are links to "Edit" or "Delete" the data in the text box. How can I make those links submit the form with the data in the textbox? To give a rough examplt, I pull a value from the database and it goes into a textbox. [code] <form method="POST" action="index.php?op=groupsmaint"> <input type="text" name="dbdata" value="$data_from_db"> <a href=' ??? '>Edit</a><a href=' ??? '>Delete</a> </form> [/code] So the form action takes me to my page with the given "op" (Which is just a switch() function call). The problem is that I don't get my "dbdata" from the textbox. So I didn't know if there was a way to "submit" without a "Submit" button. :)
  8. Cool, that does what I would need, however for .. What if the "specified cli_id" needs to come FROM the database in that query? I noticed I can change "specified cli_id" to say 1, and I get the info I need for client 1. The idea is to have the page load in a table where each row is a clients name and such and then at the end of the row, there is a recent note. EDIT: I have been trying some things using the actual info from my DB. The query as I have it now is this: SELECT cli_id, wpn_id, cli_fname, cli_lname, wpn_edit_date FROM `progress_notes` p, `clients` c WHERE c.cli_id=p.wpn_cliid ORDER BY wpn_id DESC, cli_lname ASC Now that gives me what I need, except it gives me all notes. I just need the last one for each respective cli_id. So I tried using the "LIMIT 1" and then I just get the last note overall. I assumed due to the nature of HOW I need the data, a sub-query is necessary, however as this little project I am on is an ever-learning process, I am not horrendously sure on the proper way to do it.
  9. Greetings all, I cannot seem to figure out how to do this, so I turned to the forums. I have two tables, CLIENTS and NOTES. A CLIENT can have multiple NOTES. So I need to do a query that gives me the LAST note for each client. I then am putting that into a table. (To complicate things, I need to order the client data by last name too....) I thought I could do it with a sub-query, but I very well could be doing it wrong. I tried this: SELECT * FROM 'notes' n, 'clients' c WHERE c.cli_id = n.note_cliid AND ??? (SELECT * FROM notes { FOR THE SPECIFIED CLIENT ID } ORDER BY note_id DESC LIMIT 1) An example of the tables is: CLIENTS -cli_id -cli_fname -cli_lname NOTES -note_id -note_text -note_dateentered I'm not sure if I am in the right direction. The CLIENTS table has client data, the NOTES table has multiple notes for any given client, so the query should return: CLI_ID - CLI_FNAME - CLI_LNAME - (MOST RECENT) NOTE_ID - (MOST RECENT) NOTE_TEXT etc, etc... and there is a PHP FOR loop there to get this data for each CLIENT. Any thoughts? I'm fresh out of them...
×
×
  • 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.