Jump to content

JMair

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

JMair's Achievements

Member

Member (2/5)

0

Reputation

  1. I using a current version of Joomla and have an extension that allows me to use php/html script in modules. I'm trying to add a simple input box and submit botton that writes toa text file. I'm trying to do it one script. The script writes to the text file, but the POST doesn't grab the info. Where am I'm messing up? Thanks <html> <body> <form method="POST" name="update_events" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data"> <p>Date:<input type="text" name="q1" id="q1" /> Event:<input type="text" name="q2" id="q2" /> </p> <p> <input type="submit" value="Submit" name='submit'> </p> </form> </p> <p> <?php $filename = 'shared documents of/dmead/events.txt'; $fh = fopen($filename, 'a') or die("can't open file"); $somecontent = "<B>".$_POST["q1"].": ". $_POST["q2"]."/n"; if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } fclose($handle); //END record ?> </body> </html>
  2. Thanks all. the single quotes didn't work however switching the slashes did. Thanks a ton!
  3. I think this is a php syntax error I'm not doing correctly. Here is the exact path I'm making for individual users. It works for all so far unless the user has a N for the first name, like Nancy Bell. $path = "shared documents of\nbell\Four Agreements\\"; I'm guessing this is failing because it's seeing the \n as a function? I've made a work around, but now I'm wondering how I should be solving this problem if a folder name starts with a 'n'?
  4. Thank yOU! I'm not done reading it, but it's alreads showed me that i nee dto start from scratch as my whole structure had holes.. Thanks again!
  5. I'm making a simple Php/MySQl inventory website for the computers on my campus. I'm able to wrap my brain around using a single table, but I think I'm at a point where I need to do more. Here's my question. In addition to adding info into mysql like the computers Make, Model, SN. I would also like to have a History Of Instances of a machine that ended up on my work bench, so I have a record or history of that machine. So how do I go about doing this? I'm not actually looking for php code, but more of the theory or structure to do it. Thanks a bunch.
  6. Thank you kindly! After trying it with Joomla the data passed was the string <?php echo $varto; ?> and not myemail@domain.com like I was hoping. maybe this is a Joomla thing. I'll pose the question over there. Thanks again!
  7. I'm trying to store a php variable in a html form (a static var) within a Joomla article. I dont think this is a Joomla problem as much as me not knowing how to store a value correctly.. Here is what I have on the html page.... <?php $varto = "myemail@domain.com";?> <input type="hidden" type="text" name="email" value="$varto" <br /> I know I'm butchering the syntax somehow. I've searched for php form Value, Form Value, but havent been able to find the answer. Hope you guys can help me out.. Thanks!
  8. I did before I posted but didnt see anything direct enough for me I suppose. I'll check again. Thanks guys. Also, I have to add, I've learned about as much or more from this forum than I have from my PHP book and a class I took a while ago. Thanks for the help again.
  9. 1 2 3 4 5 6 7 8 9 I get that when I do echo $i ."<br>"; I'm just unsure why the following doesn't give it in order and adds additional <br> instead. $key = array_search($i, $todo); echo $key ."<br>"; I'm just trying to understand it is all really.
  10. <?php $todo = array( 1 => "9AM Wake Up.", 2 => "10AM Drink make hot tea.", 3 => "11AM Finish reading CNET news.", 4 => "12AM Shower and get dressed.", 5 => "1PM Finish watering the garden.", 6 => "2PMTake a nap.", 7 => "3PM Dream about something fantastic.", 8 => "4PM Wake up from nap.", 9 => "5PM Go to work.", ); for ($i = 1; $i <= 20 ; $i++) { // notice the 20 in order to see the whole readout of array_search. //echo $i ."<br>"; $key = array_search($i, $todo); echo $key ."<br>"; }//end of for ?> Print out is exactly. 5 6 7 8 9 1 2 3 4 What would be causing this?
  11. That is great! However I need to return on Key and not all. I've been tinkering around with it but can't seam to get it to echo 1 key. $todo = array( "9AM" => "Wake Up.", "10AM" => "Drink make hot tea.", "11AM" => "Finish reading CNET news.", ); So if I wanted to just echo a the Key value to Wake Up. I'm not sure how to do it.
  12. I'm not even sure i have the name correct, but I think it's called the array key. $array[1] I'm referring to the 1. (Array key?) Anyhow. I have an array with each key named, and a variable assigned to each key of course. . I would like to print just the array key in an echo line and I'm not sure where to look.
  13. Thank you master Daniel0. So wise. That's exactly what I needed!
  14. Thank you for the quick reply. I was playing with that originally, but the is_dir would print out 'bool(true)' How could I stop this? Can I do something like $isDir = var_dump(is_dir('bogus_dir/abc')); if ($isDir == "1") echo "It's a Directory"."<br>"; else echo "It's some kind of file"."<br>";
×
×
  • 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.