Jump to content

rjo98

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by rjo98

  1. Thanks. You know, it's funny, looking at the nicely written one jcbones did, if seems to make a lot more sense even with my limited knowledge, and even more sense as I google things from it i'm not familiar with. Thanks to everyone who posted on this thread, I've learned a lot in these two pages of posts.
  2. It works, and looks a LOT better than the old one did! jcbones, many many thanks for your giving spirit. And at least I now have something good to look at to try to figure out how all of this should work and what it does. Oh, so $_POST is actually an array and employee and stuff are the references rather than how other languages use numbers? that makes sense, and I wondered that since it looked like a c++ array kinda.
  3. I thought I had to run php -l on the file to make sure the syntax was all correct before trying it, is that not the case? The notices in error_log don't bother me, I just thought that meant there was still a problem so I did something wrong. So was that last way that passed the php -l check the correct way to do it? If it was, I can do the other ones in the morning and see where that gets me.
  4. Tried <INPUT TYPE=\"text\" NAME=\"employee\" VALUE=\"$_POST['employee']\" SIZE=\"75\" MAXLENGTH=\"100\"></p> and <INPUT TYPE=\"text\" NAME=\"employee\" VALUE=\"$_POST["employee"]\" SIZE=\"75\" MAXLENGTH=\"100\"></p> and <INPUT TYPE=\"text\" NAME=\"employee\" VALUE=$_POST['employee'] SIZE=\"75\" MAXLENGTH=\"100\"></p> and they all errored in php -l but I tried <INPUT TYPE=\"text\" NAME=\"employee\" VALUE=$_POST[employee] SIZE=\"75\" MAXLENGTH=\"100\"></p> and it makes php -l happy, but I still get Undefined variable in error_log Am I even getting warmer?
  5. The way I've been doing it is vi'ing the file on the server, then php -l to see if it's ok, then refreshing the webpage to see what happens. I do see in error_log which lines it doesn't like when I load the page, which are all the INPUT ones, so does that mean I only need to make that one's VALUE=\"$_POST['employee']\" ? I'm going to give it a shot and will post back, maybe i'll get lucky and do something right the first time for once with this haha
  6. Original intent was to move an internal website, which this form is a piece of, to a new server before the old server dies. So the most direct way, and truly the answer to your question, is quick hack to make it work again on the new server with current versions of everything. But for my personal knowledge I'd love to repair/modernize it after the quick hack, just from a purely educational perspective to learn more about php. But really, quick hack would suffice for this.
  7. I should have just referenced it as crap code from the start, that would have made all my posts cleaner hahaha Escaping them like post #12 said makes php -l happy. I'd love to simplify by using single quotes or not having to escape everything, but i'm afraid i'd mess up more than I'd fix. ok, error_log no longer complains about that PHP_SELF !!! Can someone dumb down the explanation of how I can define things like employee?
  8. ok, figure I better take this one thing at a time, and trying to tackle what I thought would be the easier one first. I changed that line to <FORM METHOD="post" ACTION=""> but when I do a php -l on the file, I get PHP Parse error: syntax error, unexpected T_STRING for that line. even if I leave the METHOD= part the same as my OP, I still get the error.
  9. so from the code in my original post, I would just make it <FORM METHOD=\"post\" ACTION=""> like that? or is even the METHOD= part not right?
  10. even the HTML isn't good good grief. Thanks for all the help so far guys.
  11. ugh. sounds like this is a real mess. OK, I changed the <? to <?php and that magically fixed the text fields are showing the VALUE= value problem! I'm not sure I understand how to fix the PHP_SELF and the other ones, but they are indeed throwing "undefined variable" in error_log that I just found. Could someone tell me how to fix the PHP_SELF and maybe one of the other ones, then I can try the others? I'm just not sure which parts to change exactly of which lines. Looking online, I see a sample php mail form that has <form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>"> in it, but to my untrained eye, that looks very different than what I have, so i'm not sure which parts or part I should use.
  12. Hello everyone. I'm trying to learn php here on the fly because i've been tasked with moving an existing internal website to a new server because the old one is failing fast. The failing server is very old and running a much older version of php. This form when submitted should send an email but the submit button doesn't even show when running the form on the new server. Also, right now all the text fields are showing the VALUE= value. I notice if I remove VALUE= from each part that removes the text but I'm not sure if that's the proper way to fix it. Also, after the "Please wait for confirmation..." message, there is one text box prepopulated with \"ds\", then one below it with \"Click, then it appears to dump the rest of the code after </FORM> up to the last ?> onto the webpage as text. I'm guessing some coding methods changed between php4 and whatever the newest version of php is that comes with a fresh linux server install. Can anyone offer any tips or fixes? Thanks in advance. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Update My Phone Number</title> </head> <body bgcolor="White" > <table width="640"> <tr><td><hr width="640" size="2" color="Red" align="left"></td></tr> <tr><td align="left"><font size="+3"><strong>Update Employee Telephone Numbers</strong></font></td></tr> <tr><td><hr width="640" size="2" color="gray" align="left"></td></tr> </table> <br> <? $form_block = " <FORM METHOD=\"post\" ACTION=\"$PHP_SELF\"> <p><strong>Employee name: <font size=\"-1\"><em>(Exactly as it should be listed)</em></font> <font color=\"#FF0000\">**Required</font></strong><br> <INPUT TYPE=\"text\" NAME=\"employee\" VALUE=\"$employee\" SIZE=\"75\" MAXLENGTH=\"100\"></p> <p><strong>Department: <font size=\"-1\"><em>(Exactly as it should be listed)</em></font> <font color=\"#FF0000\">**Required</font></strong><br> <INPUT TYPE=\"text\" NAME=\"department\" VALUE=\"$department\" SIZE=\"75\" MAXLENGTH=\"50\"></p> <p><strong>Work Phone Number <font color=\"#FF0000\">**Required</font></strong><br> <INPUT TYPE=\"text\" NAME=\"work\" VALUE=\"$work\" SIZE=\"15\" MAXLENGTH=\"15\"></p> <p><strong>Cell Phone Number <font color=\"#FF0000\">**Required -- enter \"na\" for not applicable</font></strong><br> <INPUT TYPE=\"text\" NAME=\"cell\" VALUE=\"$cell\" SIZE=\"15\" MAXLENGTH=\"15\"></p> <p><strong>Home Phone Number <font color=\"#FF0000\">**Required -- enter \"na\" for not applicable</font></strong><br> <INPUT type=\"text\" Name=\"home\" VALUE=\"$home\" SIZE=15 \" MAXLENGTH=\"15\"> </p> <p><strong>Pager Number <font color=\"#FF0000\">**Leave blank if you don't have a pager</font></strong><br> <INPUT type=\"text\" Name=\"pager\" VALUE=\"$pager\" SIZE=15 MAXLENGTH=\"15\"> </p> <p><strong>Comments:</strong><br> <TEXTAREA NAME=\"message\" ROWS=5 COLS=50 WRAP=virtual>$message</TEXTAREA></p> <br> <p><em>Please wait for confirmation - this may take a few seconds.</em></p> <INPUT type=\"hidden\" name=\"op\" value=\"ds\"> <p><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Click here to send this report\"></p> <br> </FORM> "; if ($op != "ds") { //they need to see the form echo "$form_block"; } else if ($op == "ds") { if ($employee == "") { $employee_err = "<font color=red>Please enter employee name! **REQUIRED</font><br>"; $send = "no"; } if ($department == "") { $department_err = "<font color=red>Please enter your department! **REQUIRED</font><br>"; $send = "no"; } if ($work == "") { $work_err = "<font color=red>Please enter your work phone! **REQUIRED</font><br>"; $send = "no"; } if ($cell == "") { $cell_err = "<font color=red>Please enter your cell phone! ** REQUIRED, enter \"na\" for not applicable</font><br>"; $send = "no"; } if ($home == "") { $home_err = "<font color=red>Please enter your home phone! *REQUIRED, enter \"na\" for not applicable!</font><br>"; $send = "no"; } if ($send != "no") { // it's okay to send $msg = "Please update the following phone numbers for: \t$employee\n\n"; $msg .= "Employee name:\t$employee\n\n"; $msg .= "Department:\t$department\n\n"; $msg .= "Work:\t$work\n\n"; $msg .= "Cell:\t$cell\n\n"; $msg .= "Home:\t$home\n\n"; $msg .= "Pager:\t$pager\n\n"; $msg .= "Comments:\t$message\n\n"; $to = "[email protected]"; $subject = "Phone Update: \t$employee, - \t$department\n"; $mailheaders = "From: UpdateMyPhone\n\n"; mail($to, $subject, $msg, $mailheaders); echo "<h1><font color=blue>Thank you! Your phone update has been filed. </font></h1><br> $form_block "; } else if ($send == "no") { echo "$employee_err"; echo "$department_err"; echo "$work_err"; echo "$cell_err"; echo "$home_err"; echo "$pager_err"; echo "$message_err"; echo "$form_block"; } } ?> </body> </html>
×
×
  • 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.