Jump to content

TimUSA

Members
  • Posts

    151
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

TimUSA's Achievements

Member

Member (2/5)

0

Reputation

  1. thank you for your help, this solved it. believe it or not your explanation was easy to understand as well. thanks for taking the extra time.
  2. turned on joomla's debugging and got this:
  3. im on a virtual server, so no development server and to be honest the php.ini is typically over my head as I am still a rookie. this is from my php.ini: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Error handling and logging ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; error_reporting is a bit-field. Or each number up to get desired error ; reporting level ; E_ALL - All errors and warnings (doesn't include E_STRICT) ; E_ERROR - fatal run-time errors ; E_RECOVERABLE_ERROR - almost fatal run-time errors ; E_WARNING - run-time warnings (non-fatal errors) ; E_PARSE - compile-time parse errors ; E_NOTICE - run-time notices (these are warnings which often result ; from a bug in your code, but it's possible that it was ; intentional (e.g., using an uninitialized variable and ; relying on the fact it's automatically initialized to an ; empty string) ; E_STRICT - run-time notices, enable to have PHP suggest changes ; to your code which will ensure the best interoperability ; and forward compatibility of your code ; E_CORE_ERROR - fatal errors that occur during PHP's initial startup ; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's ; initial startup ; E_COMPILE_ERROR - fatal compile-time errors ; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) ; E_USER_ERROR - user-generated error message ; E_USER_WARNING - user-generated warning message ; E_USER_NOTICE - user-generated notice message ; ; Examples: ; ; - Show all errors, except for notices and coding standards warnings ; error_reporting = E_ALL & ~E_NOTICE ; ; - Show all errors, except for notices ; ;error_reporting = E_ALL & ~E_NOTICE | E_STRICT ; ; - Show only errors ; ;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR ; ; - Show all errors, except coding standards warnings ; ;error_reporting = E_ALL ; Print out errors (as a part of the output). For production web sites, ; you're strongly encouraged to turn this feature off, and use error logging ; instead (see below). Keeping display_errors enabled on a production web site ; may reveal security information to end users, such as file paths on your Web ; server, your database schema or other information. display_errors = On ; Even when display_errors is on, errors that occur during PHP's startup ; sequence are not displayed. It's strongly recommended to keep ; display_startup_errors off, except for when debugging. display_startup_errors = Off ; Log errors into a log file (server-specific log, stderr, or error_log (below)) ; As stated above, you're strongly advised to use error logging in place of ; error displaying on production web sites. log_errors = Off ; Set maximum length of log_errors. In error_log information about the source is ; added. The default is 1024 and 0 allows to not apply any maximum length at all. log_errors_max_len = 1024 ; Do not log repeated messages. Repeated errors must occur in same file on same ; line until ignore_repeated_source is set true. ignore_repeated_errors = Off ; Ignore source of message when ignoring repeated messages. When this setting ; is On you will not log errors with repeated messages from different files or ; source lines. ignore_repeated_source = Off ; If this parameter is set to Off, then memory leaks will not be shown (on ; stdout or in the log). This has only effect in a debug compile, and if ; error reporting includes E_WARNING in the allowed list report_memleaks = On ;report_zend_debug = 0 ; Store the last error/warning message in $php_errormsg (boolean). track_errors = Off ; Disable the inclusion of HTML tags in error messages. ; Note: Never use this feature for production boxes. ;html_errors = Off ; If html_errors is set On PHP produces clickable error messages that direct ; to a page describing the error or function causing the error in detail. ; You can download a copy of the PHP manual from http://www.php.net/docs.php ; and change docref_root to the base URL of your local copy including the ; leading '/'. You must also specify the file extension being used including ; the dot. ; Note: Never use this feature for production boxes. ;docref_root = "/phpmanual/" ;docref_ext = .html ; String to output before an error message. ;error_prepend_string = "<font color=ff0000>" ; String to output after an error message. ;error_append_string = "</font>" ; Log errors to specified file. ;error_log = filename ; Log errors to syslog (Event Log on NT, not valid in Windows 95). ;error_log = syslog
  4. I was able to get my userID and now I am getting empty query results and not sure where this is breaking down, my full code now looks like this: conducttest.php <?php require "library.php"; function conducttest() { //GET JOOMLA USER ID FOR USER $userID = getuserid(); //NEW TESTS QUERY (what purchased test are available for use with 'item_available' == '1' {unused test} and matching current 'user_id') $new_test=new_test_query(); //RESUME TESTS QUERY (what purchased test are available for use with 'item_available' == '1' {unused test} and matching current 'user_id') $resume_test=resume_test_query(); //PART1 SELECT A TEST TO BE USED if(!isset($_POST['select_test'])) { echo ' <form method="post" action="'.$PHP_SELF.'"> <fieldset> <legend>Please Select A Test To Be Used</legend> <table>'; if (empty($new_test)) { echo ' <th colspan="3"align="left">NO NEW TESTS AVAILABLE</th>'; } else { echo ' <th colspan="3"align="left">NEW TESTS AVAILABLE</th> <tr> <td width="75px">SELECT</td> <td width="50px">ID</td> <td width="150px">TEST TYPE</td> <td width="150px">UNIQUE TEST ID</td> <tr>'; foreach ($new_test as $result1) { echo ' <tr> <td><input type="radio" value="' .$result1['Id']. '" name="Id"></td> <td>'.$result1['Id'].'</td> <td>'.$result1['test_name'].'</td> <td>'.$result1['test_number'].'</td> <tr>'; } } echo ' </table> <hr /> <table>'; if (empty($resume_test)) { echo ' <th colspan="3"align="left">NO NEW TESTS AVAILABLE</th>'; } else { echo ' <th colspan="3"align="left">NEW TESTS AVAILABLE</th> <tr> <td width="75px">SELECT</td> <td width="50px">ID</td> <td width="150px">TEST TYPE</td> <td width="150px">UNIQUE TEST ID</td> <tr>'; foreach ($resume_test as $result2) { echo ' <tr> <td><input type="radio" value="' .$result2['Id']. '" name="Id"></td> <td>'.$result2['Id'].'</td> <td>'.$result2['test_name'].'</td> <td>'.$result2['test_number'].'</td> <tr>'; } } echo ' </table> </fieldset> <input type="submit" name="select_test" value="Select" /> </form>'; } else echo'nothong to do yet'; } ?> library.php <?php //GET JOOMLA USER ID & USERNAME FOR LOGGED USER function getuserid() { $userID =& JFactory::getUser(); return $userID->id; } //NEW TESTS QUERY (what purchased test are available for use with 'item_available' == '1' {unused test} and matching current 'user_id') function new_test_query() { $db =& JFactory::getDBO(); $new_test_query = " SELECT * FROM crt_transactions WHERE user_id = ".$userID." AND test_available = '1' ORDER BY test_name, id "; $db->setQuery($new_test_query); $new_test = $db->loadAssocList(); return $new_test; } //RESUME TESTS QUERY (what purchased test are available for use with 'item_available' == '2' {resume test} and matching current 'user_id') function resume_test_query() { $db =& JFactory::getDBO(); $resume_test_query = " SELECT * FROM crt_transactions WHERE user_id = ".$userID." AND test_available = '2' ORDER BY test_name, id "; $db->setQuery($resume_test_query); $resume_test = $db->loadAssocList(); return $resume_test; } ?>
  5. Learning something new here so if anyone can tell me why I this wont return a value? page1.php <?php require "page2.php"; getuserid(); echo $userID; ?> page2.php <?php function getuserid() { $user =& JFactory::getUser(); $userID = $user->id; global $userID; } ?>
  6. thanks for your help that explained it enough for me to sort it.
  7. i am writing this script for use as an include in joomla and the directphp plugin so in my joomla article i have: <?php include 'test/conducttest.php'; conducttest(); ?> Ok now my issue! the form in this function is passing only the values for the last item in the loop rather than for the selected radio item when submitted. so when say for example the radio selected is: ID TEST TYPE UNIQUE TEST ID AVAILABLE 5 Adolescent Clinical 50021629 1 and the last item in the list is: ID TEST TYPE UNIQUE TEST ID AVAILABLE 4 Adult Clinical 12341629 1 When the form is submitted even if the 1st item is selected, it returns the value for the second one. I am sorta new to php so any suggestions will be appreciated. Here is my full code: <?php function conducttest() { //GET JOOMLA USER ID & USERNAME FOR LOGGED USER $user =& JFactory::getUser(); $userID = $user->id; //GET JOOMLA DATABASE OBJECTS $db =& JFactory::getDBO(); //NEW TESTS QUERY (what purchased test are available for use with 'item_available' == '1' {unused test} and matching current 'user_id') $new_query = " SELECT * FROM crt_transactionHistory WHERE user_id = ".$userID." AND item_available = '1' ORDER BY item_name, id "; $db->setQuery($new_query); $new = $db->loadAssocList(); //OPEN TESTS QUERY (what purchased test are available for use with 'item_available' == '2' {resume test} and matching current 'user_id') $resume_query = " SELECT * FROM crt_transactionHistory WHERE user_id = ".$userID." AND item_available = '2' ORDER BY item_name, id "; $db->setQuery($resume_query); $resume = $db->loadAssocList(); //DISPLAY use_test FORM if(!isset($_POST['test'])) { //SELECT FORM: WHICH TEST WOULD YOU LIKE TO USE? echo ' <fieldset> <table> <form method="post" action="'.$PHP_SELF.'">'; if (empty($new)) { echo ' <th colspan="3"align="left">NO NEW TESTS AVAILABLE</th>'; } else { echo ' <th colspan="3"align="left">NEW TESTS AVAILABLE</th> <tr> <td width="75px">SELECT</td> <td width="50px">ID</td> <td width="150px">TEST TYPE</td> <td width="150px">UNIQUE TEST ID</td> <tr>'; foreach ($new as $result1) { echo ' <tr> <td><input type="radio" value="' .$result1['id']. '" name="test_id"></td> <td>'.$result1['id'].'</td> <td><input type="hidden" value="'.$result1['item_name'].'" name="item_name">'.$result1['item_name'].'</td> <td><input type="hidden" value="'.$result1['item_number'].'" name="item_number">'.$result1['item_number'].'</td> <input type="hidden" value="'.$result1['item_available'].'" name="item_available"> <input type="hidden" value="'.$userID.'" name="userID"> <tr>'; } } echo ' </table> <hr /> <table>'; if (empty($resume)) { echo ' <th colspan="3"align="left">NO TESTS TO RESUME</th>'; } else { echo ' <th colspan="3"align="left">RESUME TEST</th> <tr> <td width="75px">SELECT</td> <td width="50px">ID</td> <td width="150px">TEST TYPE</td> <td width="150px">UNIQUE TEST ID</td> <tr>'; foreach ($resume as $result2) { echo ' <tr> <td><input type="radio" value="' .$result2['id']. '" name="test_id"></td> <td>'.$result2['id'].'</td> <td><input type="hidden" value="'.$result2['item_name'].'" name="item_name">'.$result2['item_name'].'</td> <td><input type="hidden" value="'.$result2['item_number'].'" name="item_number">'.$result2['item_number'].'</td> <input type="hidden" value="'.$result2['item_available'].'" name="item_available"> <input type="hidden" value="'.$userID.'" name="userID"> <tr>'; } } echo ' </table> </fieldset> <input type="submit" name="test" value="Conduct Test" /> </form> '; } //NOW A TEST HAS BEEN SELECTED FOR USE if(isset($_POST['test'])) { $test_id = $_POST['test_id']; $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $item_available = $_POST['item_available']; $userID = $_POST['userID']; echo $test_id.'<br />'; echo $item_name.'<br />'; echo $item_number.'<br />'; echo $item_available.'<br />'; echo $userID.'<br />'; //IF THIS IS A NEW TEST... if ($item_available == "1") { echo 'new test'; } //IF WE ARE RESUMING A TEST... elseif ($item_available == "2") { echo 'resume test'; } } } ?>
  8. in the long run i will have probably ended up agreeing with you, so i will go ahead and agree with you now! especially after reading this thread...wow what an idiot! http://www.phpfreaks.com/forums/index.php/topic,192347.0.html Ben: problem is i barely know php, would know where to begin with js!!
  9. Yes but first I want to check if they are empty.
  10. I have a PHP question probably easy but no for me. I am developing an online employment application for my company and i want to require the user to post at least one employment reference. so i have for example $_POST['emp1'] , $_POST['emp1add'] , $_POST['emp1phone'] ect ect ect. Instead of checking each field individually can I do something like this? if (empty($_POST['emp1*'])) { execute code } If not any suggestions?
  11. Hello all. I would normally never do this, but i need some help finishing this code. I just took a new job opening a new nightclub and I am providing the ability to apply for positions online. Unfortunately I am way behind the 8-ball on everything else I have to accomplish to fiinsh this code. I need to add format error checking for each form field, and also need to have it set so the user must select from the drop down boxes, and must fill out at least one employment reference. I have a good start on this, but really need a pro's help to make this fool proof and secure. Anyone care to tackle this? global $scripturl; echo' <style type="text/css"> #formfield { width:90%; border: solid 1px; padding:25px; } </style> <h2 style="color: #EB0105;">The Ottawa Tavern, Inc Express Application</h2>'; function application() { $date = date("Y/m/d"); echo' <form action="'.$scripturl.'?page=7'.$get['page'].'" method="post"> <input name="application" type="hidden" value="TRUE" /> <h3>Personal Information</h3> <div id="formfield"> Date:<br> <input type="text" name="date" READONLY value="' . $date . '" /><hr> Last Name:<br> <input type="text" size="50"name="last" value="'.$_POST['last'].'" /><br> First Name:<br> <input type="text" size="50"name="first"value="'.$_POST['first'].'" /> </div> <br> <div id="formfield"> <div style="padding-right:15px; float:left;"> Street Address:<br> <input type="text" name="street" value="'.$_POST['street'].'" /><br> City:<br> <input type="text" name="city" value="'.$_POST['city'].'" /><br> State:<br> <input type="text" name="state" value="'.$_POST['state'].'" /><br> </div> <div style="float:left;"> Zip Code:<br> <input type="text" name="zip" value="'.$_POST['zip'].'" /><br> Telephone:<br> <input type="text" name="phone" value="'.$_POST['phone'].'" /><br> Email:<br> <input type="text" name="email" value="'.$_POST['email'].'" /><br> </div> <br style="clear:both;"> </div> <br> <div id="formfield"> Position applied for:<br> <input type="text" name="position" value="'.$_POST['position'].'" /><br> Salary desired:<br> <input type="text" name="salary" value="'.$_POST['salary'].'" /> <hr> Are you of legal age to serve alcohol:<br> <select name="age"> <option value="NA" SELECTED>No Answer</option> <option value="Yes">Yes</option> <option value="No">No</option> </select> <hr> I can work nights and weekends:<br> <select name="avail1"> <option value="NA" SELECTED>No Answer</option> <option value="Yes">Yes</option> <option value="No">No</option> </select> <hr> I am available for...<br> <select name="avail2"> <option value="NA" SELECTED>No Answer</option> <option value="Full-Time">Full-Time</option> <option value="Part-Time">Part-Time</option> </select> <hr> Have you ever been convicted of a crime:<br> <select name="crime"> <option value="NA" SELECTED>No Answer</option> <option value="Yes">Yes</option> <option value="No">No</option> </select> <hr> Do you have a valid drivers license:<br> <select name="license"> <option value="NA" SELECTED>No Answer</option> <option value="Yes">Yes</option> <option value="No">No</option> </select> </div> <h3>Employment References</h3> <div id="formfield"> <h4>Employer #1</h4> <div style="padding-right:5px; float:left;"> Name of employer:<br> <input type="text" name="emp1" value="'.$_POST['emp1'].'" /> </div> <div style="padding-right:5px; float:left;"> Address:<br> <input type="text" size="80"name="emp1add" value="'.$_POST['emp1add'].'" /> </div> <div style="float:left;"> Phone:<br> <input type="text" name="emp1phone" value="'.$_POST['emp1phone'].'" /> </div> <br style="clear:both;"> <div style="padding-right:5px; float:left;"> Start date:<br> <input type="text" name="emp1start" value="'.$_POST['emp1start'].'" /> </div> <div style="padding-right:5px; float:left;"> End date:<br> <input type="text" name="emp1end" value="'.$_POST['emp1end'].'" /> </div> <div style="padding-right:5px; float:left;"> Title:<br> <input type="text" name="emp1title" value="'.$_POST['emp1title'].'" /> </div> <div style="padding-right:5px; float:left;"> Supervisor:<br> <input type="text" name="emp1sup" value="'.$_POST['emp1sup'].'" /> </div> <br style="clear:both;"> <div style="padding-right:5px; float:left;"> Reason for leaving:<br> <input type="text" size="80" name="emp1reason" value="'.$_POST['emp1reason'].'" /> </div> <br style="clear:both;"> </div> <br> <div id="formfield"> <h4>Employer #2</h4> <div style="padding-right:5px; float:left;"> Name of employer:<br> <input type="text" name="emp2" value="'.$_POST['emp2'].'" /> </div> <div style="padding-right:5px; float:left;"> Address:<br> <input type="text" size="80"name="emp2add" value="'.$_POST['emp2add'].'" /> </div> <div style="float:left;"> Phone:<br> <input type="text" name="emp2phone" value="'.$_POST['emp2phone'].'" /> </div> <br style="clear:both;"> <div style="padding-right:5px; float:left;"> Start date:<br> <input type="text" name="emp2start" value="'.$_POST['emp2start'].'" /> </div> <div style="padding-right:5px; float:left;"> End date:<br> <input type="text" name="emp2end" value="'.$_POST['emp2end'].'" /> </div> <div style="padding-right:5px; float:left;"> Title:<br> <input type="text" name="emp2title" value="'.$_POST['emp2title'].'" /> </div> <div style="padding-right:5px; float:left;"> Supervisor:<br> <input type="text" name="emp2sup" value="'.$_POST['emp2sup'].'" /> </div> <br style="clear:both;"> <div style="padding-right:5px; float:left;"> Reason for leaving:<br> <input type="text" size="80" name="emp2reason" value="'.$_POST['emp2reason'].'" /> </div> <br style="clear:both;"> </div> <br> <div id="formfield"> <h4>Employer #3</h4> <div style="padding-right:5px; float:left;"> Name of employer:<br> <input type="text" name="emp3" value="'.$_POST['emp3'].'" /> </div> <div style="padding-right:5px; float:left;"> Address:<br> <input type="text" size="80"name="emp3add" value="'.$_POST['emp3add'].'" /> </div> <div style="float:left;"> Phone:<br> <input type="text" name="emp3phone" value="'.$_POST['emp3phone'].'" /> </div> <br style="clear:both;"> <div style="padding-right:5px; float:left;"> Start date:<br> <input type="text" name="emp3start" value="'.$_POST['emp3start'].'" /> </div> <div style="padding-right:5px; float:left;"> End date:<br> <input type="text" name="emp3end" value="'.$_POST['emp3end'].'" /> </div> <div style="padding-right:5px; float:left;"> Title:<br> <input type="text" name="emp3title" value="'.$_POST['emp3title'].'" /> </div> <div style="padding-right:5px; float:left;"> Supervisor:<br> <input type="text" name="emp3sup" value="'.$_POST['emp3sup'].'" /> </div> <br style="clear:both;"> <div style="padding-right:5px; float:left;"> Reason for leaving:<br> <input type="text" size="80" name="emp3reason" value="'.$_POST['emp3reason'].'" /> </div> <br style="clear:both;"> </div> <br> <div id="formfield"> <input type="submit" value="submit" style="padding-right:5px;" /> <input type="reset" value="reset" /> </div> </form>'; } if (!isset($_POST['application'])) { application(); } else { if (isset($_POST['application'])) { $process = true; //check format personal information if (!ereg("[A-Za-z' -]{1,50}", $_POST['last'])) { echo' One or more fields have information that appears to be incorrect. Last Name: '.$_POST['last'].'<br>'; $process = false; } if (!ereg("[A-Za-z' -]{1,50}", $_POST['first'])) { echo' One or more fields have information that appears to be incorrect. First Name: '.$_POST['first'].'<br>'; $process = false; } if (!ereg("[A-Za-z' -]{1,50}", $_POST['city'])) { echo' One or more fields have information that appears to be incorrect. City: '.$_POST['city'].'<br>'; $process = false; } if (!ereg("[A-Za-z' -]{1,50}", $_POST['state'])) { echo' One or more fields have information that appears to be incorrect. State: '.$_POST['state'].'<br>'; $process = false; } if (!ereg("[^0-9]",$_POST['zip'])) { echo' One or more fields have information that appears to be incorrect. Zip: '.$_POST['zip'].'<br>'; $process = false; } if (!ereg("[^0-9]",$_POST['phone'])) { echo' One or more fields have information that appears to be incorrect. Phone: '.$_POST['phone'].'<br>'; $process = false; } $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; if (!eregi($pattern, $_POST['email'])) { echo "You entered an invalid e-mail address<br>"; $process = false; } if ($process == false) { application(); } if ($process == true) { $sendto = "ottawatavern@yahoo.com"; $subject = 'An application for employment has been made by '.$_POST['first'].' '.$_POST['last']; $body = ' An application for employment has been made by '.$_POST['first'].' '.$_POST['last'].' Street: '.$_POST['street'].' City: '.$_POST['city'].' State: '.$_POST['state'].' Zip: '.$_POST['zip'].' Phone: '.$_POST['phone'].' Email: '.$_POST['email'].' Position: '.$_POST['position'].' Salary: '.$_POST['salary'].' Alcohol Service: '.$_POST['age'].' Nights and Weekends: '.$_POST['avail1'].' Availability: '.$_POST['avail2'].' Crime: '.$_POST['crime'].' ---Employment Information--- Empoyer 2: '.$_POST['emp1'].' Address: '.$_POST['emp1add'].' Phone: '.$_POST['emp1phone'].' Start: '.$_POST['emp1start'].' End: '.$_POST['emp1end'].' Title: '.$_POST['emp1title'].' Supervisor: '.$_POST['emp1sup'].' Reason for leaving: '.$_POST['emp1reason'].' ---Employment Information--- Empoyer 3: '.$_POST['emp2'].' Address: '.$_POST['emp2add'].' Phone: '.$_POST['emp2phone'].' Start: '.$_POST['emp2start'].' End: '.$_POST['emp2end'].' Title: '.$_POST['emp2title'].' Supervisor: '.$_POST['emp2sup'].' Reason for leaving: '.$_POST['emp2reason'].' ---Employment Information--- Empoyer 1: '.$_POST['emp3'].' Address: '.$_POST['emp3add'].' Phone: '.$_POST['emp3phone'].' Start: '.$_POST['emp3start'].' End: '.$_POST['emp3end'].' Title: '.$_POST['emp3title'].' Supervisor: '.$_POST['emp3sup'].' Reason for leaving: '.$_POST['emp3reason']; mail($sendto,$subject,$body); echo' Thank you for your application. We will be contacting you soon.<br> This is an express application. If you are contacted for an interview, you will be required to fill out a complete written application.<br>'; } } }
  12. Hello all. I would normally never do this, but i need some help finishing this code. I just took a new job opening a new nightclub and I am providing the ability to apply for positions online. Unfortunately I am way behind the 8-ball on everything else I have to accomplish to fiinsh this code. I need to add format error checking for each form field, and also need to have it set so the user must select from the drop down boxes, and must fill out at least one employment reference. I have a good start on this, but really need a pro's help to make this fool proof and secure. Anyone care to tackle this?
  13. yep tried that just redisplaying the form after submit http://vsk-ayc.totalh.com/Untitled.php
×
×
  • 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.