| |

VerySource

 Forgot password?
 Register
Search
View: 16|Reply: 10

Novice ask PHP strange problem?

[Copy link]

1

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-3-15 20:00:01
| Show all posts |Read mode
The php source files are as follows:

1 <form method = post name = list action = list_all.php>
2 <input type = hidden name = page value = <? = $ Page? >>
3 <input type = hidden name = id value = <? = $ Id? >>
4 <input type = hidden name = select_arrange value = <? = $ Select_arrange? >>
5 <input type = hidden name = desc value = "<? = $ Desc?>">
6 <input type = hidden name = page_num value = <? = $ Page_num? >>
7 <input type = hidden name = selected>
8 <input type = hidden name = exec>
9 <input type = hidden name = keyword value = "<? = $ Keyword?>">
10 <input type = hidden name = sn value = "<? = $ Sn?>">
11 <input type = hidden name = ss value = "<? = $ Ss?>">
12 <input type = hidden name = sc value = "<? = $ Sc?>">

From the browser "View Source File" you can see the returned content to:
...
<input type = hidden name = desc value = "

That's all there is to stop! That is to say, this code will terminate when it reaches the variable $ desc on line 5. It should be a problem with variable $ desc, but I output it with echo before the first line. But it shows that the value is "asc"
And I delete the 5th line. The same error will continue to appear on the 6th line, ... the 9th line, the 10th line, the 11th line ...

This problem is really weird. The younger brother is a novice again. It is really the second monk who is scratching his head. Here I would like to ask your predecessors how to solve it, younger grateful!
Reply

Use magic Report

0

Threads

4

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-6-15 12:00:02
| Show all posts
1 It is recommended that those with double quotes should be marked with
2 It can also be written like this: <input type="hidden" name="page" value="<? echo $page;?>">
Reply

Use magic Report

0

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-6-15 19:45:01
| Show all posts
There are double quotes in $desc, change to <?=htmlspecialchars($desc)?>
Reply

Use magic Report

0

Threads

7

Posts

8

Credits

Newbie

Rank: 1

Credits
8

 China

Post time: 2020-6-16 18:00:02
| Show all posts
The string is enclosed in quotation marks and is at least common sense
Reply

Use magic Report

2

Threads

9

Posts

9

Credits

Newbie

Rank: 1

Credits
9

 Asia/Pacific Region

Post time: 2020-6-17 07:30:01
| Show all posts
Right upstairs
Reply

Use magic Report

0

Threads

15

Posts

12

Credits

Newbie

Rank: 1

Credits
12

 China

Post time: 2020-6-18 21:15:01
| Show all posts
Write according to the standard. Attribute double quotes.
Reply

Use magic Report

1

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

 Author| Post time: 2020-6-22 12:30:02
| Show all posts
Thank you very much for your suggestions, but I have not been able to solve the problem according to your methods! Even the method on the 3rd floor will not work. Can anyone really solve this problem?

What you said is to add double quotes in the attribute. I agree, but it is obvious that the problem should be in the php program, that is, the variable $desc,
It has nothing to do with html because the PHP has been terminated when it reaches the variable!

The problem is still there, I hope there is a senior who can advise me again! Thank you very much!
Reply

Use magic Report

0

Threads

13

Posts

12

Credits

Newbie

Rank: 1

Credits
12

 China

Post time: 2020-6-24 10:15:01
| Show all posts
The code is very irregular, this should pay attention

Use the value attribute, otherwise...
Reply

Use magic Report

0

Threads

13

Posts

12

Credits

Newbie

Rank: 1

Credits
12

 China

Post time: 2020-6-24 16:15:01
| Show all posts
1 <form method=post name=list action=list_all.php>
2 <input type=hidden name=page value='<?=$page?>'>
3 <input type=hidden name=id value='<?=$id?>’>
4 <input type=hidden name=select_arrange value='<?=$select_arrange?>'>
5 <input type=hidden name=desc value='<?=$desc?>'>
6 <input type=hidden name=page_num value='<?=$page_num?>'>
7 <input type=hidden name=selected>
8 <input type=hidden name=exec>
9 <input type=hidden name=keyword value='<?=$keyword?>'>
10 <input type=hidden name=sn value='<?=$sn?>'>
11 <input type=hidden name=ss value='<?=$ss?>'>
12 <input type=hidden name=sc value='<?=$sc?>'>

Of course, please use echo to output all the variables. Also, it is better to use <?php ?> tags
Reply

Use magic Report

0

Threads

7

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

Post time: The day before yesterday 16:15
| Show all posts
Remove =
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list