Jump to content

SergeiSS

Members
  • Posts

    239
  • Joined

  • Last visited

Everything posted by SergeiSS

  1. It's not a POST problem! It means that you can't read in English What is written? "parse_str() expects parameter 1 to be string, array given" - what is POST? It's an array. PHP is right, you give to the function parse_str() an array instead of string. "Invalid argument supplied for foreach()" is also correct because you send $query to this function and suppose it's an array. But why are you sure that it's an array?
  2. These are not steps, these are different possibilities. 1. Use include() http://ru.php.net/manual/en/function.include.php 2. Use file_get_contents() http://ru.php.net/manual/en/function.file-get-contents.php 3. May use iframes...
  3. "if the _POST var would have any value" == if( count( $_POST) ) but not that you did. And.... It seems that you didn't see the part of my answer concerning variable's assignments I mean that this code $t_name=isset( $_POST['name'] ? trim($_POST['name']) : ''; is better than you use.
  4. OK... You may use: 1. include() - the best solution, AFAIK for such a case 2. echo file_get_contents('name_of_you_file); - that you wish now; will work only a case with HTML without PHP 3. .... some other methods
  5. Well... It's true. Check your if-else counstruction. If $t_name is not empty, then $n_err will be undefined variable. Also, in the beginning this comparison if( $_POST) is incorrect! What are you checknig? Nothing. You'd check like here if( isset( $_POST['any_submit'] ) {.... } // the next line $t_name=trim($_POST["name"]); // you'd change to $t_name=isset( $_POST['name'] ? trim($_POST['name']) : ''; // and forget about $n_err; just check if( $t_name <> '' ) ..... // any code
  6. You'd better say the aim of this action. Maybe it's better to use CSS for it.
  7. What kind of error did you get with include()?
  8. I'm not sure what do you like to do... One of the problems is that you say HTML about the file containing PHP code. You maybe like to use include() or include_once() for your aim?
  9. It seems that you try to create a function that was created already exists in PHP. Did you hear about class DateTime http://ru2.php.net/manual/en/book.datetime.php ? It has many abilities.
  10. scootstah, if he has incorrect settings in php.ini, he would get FILES archive and get error code not equal to 0. I think something is wrong in his form, maybe any quote is missed or anything else. That's why I ask TC - show code of you form.
  11. It seems that you problem is in this line or, better say, before this line: You didn't assign value to this variable. I suggest it might come from GET. Write this string before that comparison $action = (!empty($_GET['action']) ) ? $_GET['action'] : ''; BTW here you have a mixture of GET and POST variables. It's not a problem, of course, but you must understand how to work with them.
  12. You are welcome
  13. I just checked your code - it works fine at my localhost. In my case I am at /test and create a file in /tmp. Do you have this directory '/inc'? If you have it maybe that you don't have a permission to write.
  14. freaker87, well... 1. You'd better place control part in the beginning and then place your form. You need it because (a) your header will not be used if you try to call header after form generation and (b) you may show entered information if you show this form again, when something is wrong and you wish to give a user another chance to enter correct data. 2. Short example, just in order to show an algorithm. Compare it with your code by youself (many comments are inside the code). <?php // control part, in the very beginning of the script if( isset( $_POST['go'] ) ) // when a button was pressed { // do whatever you wish: save data to DB, perform any checking.... if( info_is_correct_version1 ) // we like to go back to this script but without entered info { header( 'Refresh: 10,'.$_SERVER['PHP_SELF']); echo ..............; // output any info - but why do you like JS dialogs? Just send any formatted text to a browser exit(); } if( info_is_correct_version2 ) // we like to to any other page, also without entered info - the save structure { header( 'Refresh: 10, any_other_script.php'); echo ..............; // output any info - but why do you like JS dialogs? Just send any formatted text to a browser exit(); } } ?>
  15. Yes, it's possible. Without JS. But you have to create a "special links". It might contain a link to a special script at your site and external link as a GET parameter for it. For example "count_links.php?http://www.google.com". This script count_links.php have to get a parameter, insert any information into DB and then route user to http://www.google.com. I think it's the task that you asked.
  16. You may put include() in any part of you PHP file! The main idea is that you create this php file one time and then never rewrite it. Instead of rewriting php file you rewrite log file only. Every time when php file is loaded it includes the current version of log file. Next time an updated log file will be called. And once more: place include('log_file.log'); anywhere you wish. I mean that you have to look on a problem from another point of view. And you would find that my idea solves the task that you asked - as I think, of course
  17. ...read my previous answer.... And do what I said
  18. It seems that you'd better change your logic... 1. Write log to a separate file. 2. Write include('this_separate_file.log') in the log.php at the bottom, at the place where you are trying to write log info, instead of this log info. 3. White log info in any sequence as you wish. 4. Enjoy
  19. nottoolate - could you explain more detail... In the beginning you say nothing about MySQL.
  20. OK... I give you one of my functions which is solving the same task: creation of a correct link according to parameters that user entered. JS: function set_correct_reference() { var date_process=document.getElementById( 'date_process' ).value; var date_process_end=document.getElementById( 'date_process_end' ).value; var load_stat_day=document.getElementById( 'load_stat_day' ); var period_count=document.getElementById( 'period_count' ).value; var load_alc=document.getElementById( 'load_alcatel' ); var load_alc_sim_eric=document.getElementById( 'load_alc_sim_eric' ); var summary=document.getElementById( 'final_summary' ); var util=document.getElementById( 'final_util' ); var top20=document.getElementById( 'final_top20' ); var final_load=document.getElementById( 'final_load' ); if( period_count != 1 && period_count != 7 ) period_count=1; load_stat_day.href='load_stat_day_manual.php?date='+date_process; load_stat_day.title=load_stat_day.href; load_alc.href='load_stat_day.php?what=alcatel&date='+date_process; load_alc_sim_eric.href='load_stat_day.php?what=newinfo&date='+date_process+'&summary&util&top20'; final_load.href='load_stat_day.php?date='+date_process; if( summary.checked ) final_load.href += '&summary'; if( util.checked ) final_load.href += '&util'; if( top20.checked ) final_load.href += '&top20'; if( !summary.checked && !util.checked && !top20checked ) final_load.href = ''; } HTML: Dates from <input type="text" name="date_process" id="date_process" value="YYYY-MM-DD" onkeyup="set_correct_reference(); " size="15" /> to <input type="text" name="date_process_end" id="date_process_end" value="YYYY-MM-DD" onkeyup="set_correct_reference(); " size="15" /> .... <a id="load_alcatel" href="load_stat_day.php?what=alcatel" onclick="return confirm('Start processing Alcatel-specific data for '+document.getElementById('date_process').value+'?' )" target="_blank">Prepare Alcatel-specific data </a> .... <input type="checkbox" id="final_top20" checked="checked" onclick="set_correct_reference();" /> <label> Count TOP-20 </label><br /> <a href="" id="final_load" target="_blank" onclick="return confirm('Are you sure you want to start process for '+document.getElementById('date_process').value+'?')"> Start processing of all data according to selected parameters </a> ... All that you need - (1) to understand this code and (2) adapt it for your needs. As you see (or as you might see ) when use change some parameters in any input kind many links are changed. User may enter text, set or unset checkboxes - all this actions a reflected immediately in that links. I hope it will help you. PS. Of course, I call function set_correct_reference() for the first time just when my page is loaded.
  21. You need a JS function to do it. This function might be called from "onclick" for every radio-button, also add value of radio as a parameter to the function. Inside this function you have to create and set a new URL for Edit or Delete.
  22. I give you algorithm... It's better than code Sorry - but it's out of my principles. I can give a code just in one case: when I see that a man tried to do something and fail. In all other cases I explain algorithm. And as I see - the same order there is in the rules of this site. Try to write code by yourself. If you fail, we will check it together.
  23. echo is wrong here. require_once('header_'.$_SESSION['session_idioma'].'.php');
  24. Here usort() is a function that you need. The only thing that you need - to create correct call-back function. It might compare second columns from 2 elements and return correct value.
×
×
  • 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.