web_API post to php file on server not working

I am having trouble getting thunkable x to Post data to my php file.

I have a basic php file on my web server which returns the posted value.
I’ve created a block in AppInventor2 shown below which works fine

this gives me the result ‘Fred-ok’

I have created a similar block in Thunkable shown here
thunkableblocks

this just gives back the result ‘-ok’

i have added the header and query in the design page
thunkabledesign

and have tried it using the header and query blocks but still cannot get the php code to see the post value

the php code looks like this

Untitled

I have tried some variations like putting the application/x-www-form-urlencoded in the body as shown in the scrWebApi sample but cannot seem to find the solution

any help would be greatly appreciated

thanks

Tried searching the forums, tried multiple solutions using text or json with still no luck, nothing seems to work so im starting to think there is a bug in the post block

Check example on scrWebApi in

https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/

thanks, i have looked at your scrWebApi but have not managed to modifiy it so it works with my basic php code

could you explain what is going on in your code, you use webviewer and web_api, do you think i should post with webviewer how what blocks should i be using

my final plan is to post several pieces of information to my php script at once, email, password, text info etc

thanks for any help you can give me

Pay attention to how you need to get data correctly in the PHP script (use isset!).

изображение

<?
	echo "worked";
	if(isset($_POST['search'])) {
		$value = $_POST['search'];
		echo '----'.$value;
	}
?>
1 Like

thank you ever so much, that is exactly what ive been looking for.

the php code works fine as it is but will add the isset check in the proper code

many beers to you