Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. What you need to do is have a hidden field (<input type='hidden' name='submit' id='submit_hidden'> that you populate with the value of your submit button when the js code submits the form. document.getElementById('submit_hidden').value=(your real submit button's value); Now your php code will see a $_POST['submit'] element and your script will function as if they clicked the button instead of the onchange doing the submit.
  2. You haven't defined $url for the test you are doing midway. Also - what is 'none'? Not a string;not a var. So I think the test of "$url != none" always fails and hence no copy-ing occurs.
  3. Yes - you will need to escape that double quote for the onfocus part. So - what isn't working? Are you getting the $html var set with the content of the form? Have you echoed it to see what it looks like? If you are getting the content, what are you doing with it next? What isn't working???
  4. I don't believe that this code actually runs. Turn on error checking and do some cleanup and you might find what's wrong. What is this line: header('Location: contact?sent.php'); Not a valid url here. What is this line: $message1 =$subject = $headers = - to save space Certainly a php syntax error is generated. As for checking if $errors is empty - you always set it here: //make sure no urls are in any of the fields $errors[]= 'Please do not enter url\'s in any of the fields.'; so it will never be empty. Once you clean it up some maybe we can look at code we know is at least trying to work. And where exactly is the email being sent? Couldn't find that.
  5. I took your code and ran it and it worked just fine. When I tabbed into the email field the prompt went away. although I did add an onload to the body tag to get the focus to happen automatically (and some ids). Show us what your "swapped" version looks like.
  6. Since a CSV file depends on the commas to retain its structure, changing the comma-delimited field holding the name into one that now holds a comma as well, you'll be changing the file layout. Will that affect other users, or just you? So - if you are proceeding - if you know exactly which field in every row holds the current name value it's pretty easy. (Here's where you should have provided your attempt at coding): (for the admins - my browser doesn't have any editing tags enable in this window) <? if (!$hdl_in = fopen((your starting filename),"r")) { echo "Could not open input file"; exit(); } if (!$hdl_out = fopen((your output filename),"c")) { echo "Could not open output file"; exit(); } $in_cnt=0; $out_cnt=0; while ($row = fgets($hdl_in)) { $in_cnt++; $fields = explode(",",$row); $name = $fields[0]; // I AM ASSUMING THAT THE NAME IS IN THE 1ST FIELD OF EACH LINE $nm_parts = explode(" ",$name); // watch out for multiple spaces in names or names with more than // 3 parts to them if (count($nm_parts)>3) { $fields[0] .= "xxx"; // look for xxx in your completed file and fix manually } else { $fields[0] = $nm_parts[2].", ".$nm_parts[0]." ".$nm_parts[1]; } $newrow = implode(",",$fields); fputs($hdl_out,$newrow); $out_cnt++; } fclose($hdl_in); fclose($hdl_out); echo "File conversion complete<br>"; echo "Read $in_cnt records; wrote out $out_cnt records<br>"; exit();
  7. Functions are so simple - there isn't a lot of need for instructions. Functions are available in most programming languages and work pretty much the same in each. Go here: us.php.net/manual/en/language.functions.php
  8. Which section of code are you talking about? They don't seem to be related, so not quite sure what you are asking for help on. Regarding your initial question about storing into an array, you are doing that with the fetchall statement, but I don't see how that carries into the next section. Also your echo of $rows is going to look pretty funny. You should do this: foreach ($rows as $k=>$v) echo "$k is $v<br>"; Also - what is the line: $line = array() doing for you? As for the second example - don't know what that is doing, since it is incomplete, but the output looks pretty funky here as well. Looks like you are going to create an un-ordered list element with one item in it over and over again. Is that what you want to do?
  9. Do you mean you have this in your query: WHERE record_date > $current_id ?? You can't compare a date field to a numeric value. At the least I think you need quotes, if that is really a valid test for your application
  10. You need to check if that long query runs ok. I suspect it is wrong. You are combining two separate un-related queries into one execution. After your MySQL_query(); add this: if (!$sql) { echo "Query did not run - message is: ".MySQL_error()"; exit(); }
  11. echo some information during the whole process so we can see what is happening. Be sure to echo out the value of the username and the password that you are using in your query.
  12. You have too many quotes in your option lines - you only need the single quotes around $val, not the escaped double quotes as well. See my previous example please.
  13. Don't know what you are asking for. My idea simply gives you what you want to have - the code in order to make your next select box work and the name of that code which you said you also needed. You'll have to figure out how to implement it and then show us what you have. When you say it doesn't work, what do you mean? Do you have an error message? (do you have error reporting turned on?)
  14. I can't follow the complex option statement. That's why I did it in two lines $val = $row['code_ano']."|".$row['nomo_ano']; Then use that $val to make the option easier to read: echo "<option value='$val' " . $ano == $row["cod_ano"]? " selected" : "" . ">$row[nome_ano]</option>"; Now your screen will show the name in the dropdown and your php will get something like this: $code_ano = $_GET['code_ano']; list($ano,$ano_name) = explode("|",$code_ano); $ano will have the code; $ano_name will have the title.
  15. Lotta code there! It appears that you are using php to check the user's first selection, using the code to look up the values for the second selection, and so on. One way would be to re-query your tables for the names associated with the codes that were selected after all the selections are complete. Another way could be to combine the code and the name in the 'value=' value clause and then when reading it from your POST, explode it into two vars - code and name. Your value clause would look like: $val = $row['code_ano']."|".$row['nomo_ano']; echo "<option value='$val'...... Then explode that using the | char to break it back down.
  16. Well, if you want the name to be returned by the user's selection choice on the first one, that is what you must change. As for the cascading effect to bring up the second select box, that is something you'll have to show us first.
  17. Your value= clause is the culprit. Change the name of the table column and you'll have it.
  18. Am I hearing that you want to call a JS function from PHP?
  19. What is the name of this file? Also - you are wondering about your JS, yet you aren't showing us any JS code. Where does the JS code come into play here?
  20. ginerjm

    PHP Poll

    We would have helped you if you had helped us by pointing out where you thought the problem was occurring. You were asked. You refused. Who sux now? Go home, grow up, learn to read and write better English. Come back as an adult.
  21. There are several good examples on how to setup an xmlhttprequest in your js code to call a php script behind the scenes and do what you want to do. Google it.
  22. Here is the link again: us.php.net/manual/en/funcref.php
  23. In php forums the reference to "manual" usually means the "PHP Manul", which is the bible for using php. http://us.php.net/manual/en/funcref.php
  24. Very difficult to help when all we are getting is a couple pieces of some supposed code. How about showing us the full lines involved? Not the whole script, but the parts you are mentioning.
×
×
  • 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.