Tuesday 15 February 2011

php - Sometimes missing textarea value when processing POST -


I'm having trouble with a texture post value that is never being processed. The problem is that in the brain, Some values ​​are unavailable for Textrea 27 and 30. It does not seem to be a browser issue and it does not have a problem with the length of the data.

This form is HTML:

  & lt; Div id = "surveycontainer" & gt; & Lt; Form method = "POST" verb = "blog / question" name = "exit" & gt; & Lt; Input id = "pnum" type = "hidden" name = "pegzam" value = "3" /> & Lt; Div class = "qsection" & gt; & Lt; P & gt; 27. Suppose a friend from another country will come to see you and you do not know about the US economy. How do you & lt; Duration style = "font-style: italic" & gt; Description of the economy & lt; / Span & gt; to your friend? In fact, as much as possible you would write those words. & Lt; / P & gt; & Lt; Textarea id = "mlq1" name = "27" cols = "50" lines = "5" & gt; & Lt; / Textarea & gt; & Lt; / Div & gt; & Lt; Div class = "qsection" & gt; & Lt; P & gt; 28. What is your opinion about the future of the US economy? Do you think that in the next few months the US Will the economy improve, get worse, or stay the same? & Lt; / P & gt; & Lt; Input type = "radio" name = "28" value = "- 2" & gt; & Lt; Span class = "radixt" & gt; -2 (very bad) & lt; / Span & gt; & Lt; Br / & gt; & Lt; Input type = "radio" name = "28" value = "- 1"> gt; & Lt; Span class = "radiotext" & gt; -1 (poor) & lt; / Span & gt; & Lt; Br / & gt; & Lt; Input type = "radio" name = "28" value = "0" & ​​gt; & Lt; Span class = "radiotext" & gt; 0 (stay same) & lt; / Span & gt; & Lt; Br / & gt; & Lt; Input type = "radio" name = "28" value = "1" & gt; & Lt; Span class = "radiotext" & gt; 1 (better) & lt; / Span & gt; & Lt; Br / & gt; & Lt; Input type = "radio" name = "28" value = "2" & gt; & Lt; Span class = "radiotext" & gt; 2 (too much) & lt; / Span & gt; & Lt; / Div & gt; & Lt; Div class = "qsection" & gt; & Lt; P & gt; 29. What are the reasons for your prediction? Explain or list them & lt; / P & gt; & Lt; Textarea id = "mlq2" name = "29" cols = "50" lines = "5" & gt; & Lt; / Textarea & gt; & Lt; / Div & gt; & Lt; Div class = "qsection" & gt; & Lt; P & gt; 30. U.S. What do you suggest as a solution to improve the economy? & Lt; / P & gt; & Lt; Textarea id = "mlq3" name = "30" cols = "50" lines = "5" & gt; & Lt; / Textarea & gt; & Lt; / Div & gt;   

And here is the processing PHP:

  Personal function processors ($ pid) {date_default_timezone_set ('America / Chicago'); $ Made = date ("Y-M-DHH: I: S"); Forex Currency ($ _ POST $ as Key => Value =) {If ($ key == "PageName") continues; // resonant "$ key: $ value \ n"; $ Sql ​​= "Insert into the default_reference (participant_id, answer_id, answer_value, created) value (". $ Pid. ", '' .htmlspecialchars ($ key). '', '' .htmlspecialchars ($ value)" $ Made. "'')"; // echo $ sql; $ This- & gt; Db- & gt; Query ($ SQL); This is the code that calls it:  
  if (isset ($ _ POST ['pagenum'])) {$ pagenum = $ This - & gt; Input-> Post ('pagenum'); $ This- & gt; ProcessAnswers ($ PID); }   

Thank you

Thanks Mock Dear, it was. Mysql_real_escape_string (htmlspecialchars) This was happening when there was a quote in the input.

No comments:

Post a Comment