国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

ajax - Problems with php getting values ??from the front end
僅有的幸福
僅有的幸福 2017-05-16 13:03:16
0
12
1385

Dear friends, I am new to PHP. As shown in the picture, the same variable $name has no value when outputted by echo. However, the input value can be found from the database below. Why is this? , detailed questions, code attached below

This is a screenshot of the ajax request of the front-end page

僅有的幸福
僅有的幸福

reply all(12)
左手右手慢動作

Youpost到后端的時候是個空值嗎? 您用echo 為空時就看不到的,您用var_dump($_POST)print it like this

洪濤

The first name is taken from the form (ie: submitted by the user), and the latter name is from the database (and name is a field in the database)

The previous name can be named whatever you want. For example, $a = $_POST['name']; var_dump($a); If it is empty, it means that the user did not enter when submitting the form.

The $row['name'] at the end cannot be written randomly. For example: if you write $row['abc'], it will have no value. Because there is no abc field in the data table

為情所困

Hmm, I recommend jquery as a simpler ajax post method

$.post(uri,{'argu':data},function(res){
...你的回調(diào)操作...
})

This method is simpler

給我你的懷抱

The value of your $name is to assign the name of the post, so the name and data you want to output need to be executed first (that is to say, there will be no output if this processing page onlinedb.php is accessed directly)
Then when you After performing the ajax operation. Post has passed an array. At this time, if you echo $name; have not deleted this line, you should be able to see the output in the network status, as shown in the picture

You try it

phpcn_u1582

...
You haven’t posted anything worth it, how can it be worth it?

過去多啦不再A夢

1. Check whether inputname has data in JS.
2. Use the browser debug to see if there is data in the name in the requested onlinedb.php

為情所困

The error level is too high
Add a sentence to the header
error_reporting(0);

習(xí)慣沉默

Can be used

>var_dump($name);die();

Cut it off and take a look!

過去多啦不再A夢

What you print at the top is the value passed in this time.
The value you print at the bottom is traversed through the database. How do you know which one is generated this time?

世界只因有你

The logic is wrong. The value queried in the database is not the value submitted this time, but the value inserted previously

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template