Jump to content


Ajax.InPlaceEditor Server Scripting Problem


8 replies to this topic

#1 kuosion

    Young Padawan

  • Members
  • Pip
  • 6 posts

Posted 28 July 2008 - 11:05 PM

So here is my problem. I looked ALL over Google and what not but cannot find why this does not work.
I simplified my code all the way and yet it still doesn't work.
What should happen is that whatever you type in the "inplaceeditor" should be returned however it does not. I'm open to all suggestion.

here is my .html
<p id="test">Blah Blah Blah</p>
<script type="text/javascript">
<!--
new Ajax.InPlaceEditor('test', 'ajax.php');
-->
</script>

here is my .php
<?php
$value = $_POST['value'];
if($_POST['value'] != ''){
	echo $value;
} else {
	echo '$_POST[\'value\'] was not received.';
}
?>

I tested this and all I get is "$_POST['value'] was not received."
Obviously something is not right. If you could help that would be great.

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 28 July 2008 - 11:43 PM

What script are you working with (prototype)?

Add the following to your .php (at the top)
die(print_r($_POST,1));


#3 kuosion

    Young Padawan

  • Members
  • Pip
  • 6 posts

Posted 29 July 2008 - 02:14 AM

Yea, i'm using prototype.

With the code you told me to put in I get a new message:


Array()

#4 Tyson D

    Young Padawan

  • Members
  • Pip
  • 85 posts
  • Gender:Male
  • Location:Canada

Posted 29 July 2008 - 08:24 AM

Where are you getting "value" from? Show more code please!

#5 kuosion

    Young Padawan

  • Members
  • Pip
  • 6 posts

Posted 29 July 2008 - 12:45 PM

From what I know, $_POST['value'] is what Ajax.InPlaceEditor submits. This is all the code other than the Prototype.js which I got from script.aculo.us.

There is a wiki that explains a little more at Ajax.InPlaceEditor Wiki. However it doesn't tell me why my code is not returning the correct value.

#6 kuosion

    Young Padawan

  • Members
  • Pip
  • 6 posts

Posted 31 July 2008 - 03:29 AM

Also I found in my error_log

[28-Jul-2008 20:34:34] PHP Warning:  Unknown: POST Content-Length of 26 bytes exceeds the limit of 0 bytes in Unknown on line 0


#7 kuosion

    Young Padawan

  • Members
  • Pip
  • 6 posts

Posted 31 July 2008 - 04:15 AM

OK, i've simplified it even further.

Using Prototype 1.6.0 final

index.php
<h1 id="test">Test value</h1>
<script type="text/javascript">
		new Ajax.InPlaceEditor('test', 'ajax.php',{callback: function(form, value) { return 'name=' + escape(value)}});
</script>

ajax.php
<?php
$var = $_POST['name'];
echo $var;
?>


#8 kuosion

    Young Padawan

  • Members
  • Pip
  • 6 posts

Posted 31 July 2008 - 03:53 PM

OK, I solved my problem.
Some values in my php.ini was changed so I loaded a default php.ini and everything was working fine and dandy.
Thanks for the suggestions anyways.

#9 Tyson D

    Young Padawan

  • Members
  • Pip
  • 85 posts
  • Gender:Male
  • Location:Canada

Posted 31 July 2008 - 04:05 PM

Phew. I was beginning to wonder about this one! :P Glad you sorted things out.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users