+ 1

Why can't I pass value via url in php?

https://code.sololearn.com/w601NMDkgDQ6/?ref=app the id1 isn't working when I use the get method but the id is working

7th Dec 2021, 6:27 AM
Azalea
14 odpowiedzi
+ 3
Aah finally get it You have a space there at line 11, and that space is translated as %20 in the code '&id1 ='.$show['cart_id'] You see the space between &id1 and the = sign ...
7th Dec 2021, 10:14 AM
Ipang
+ 2
Explain "did not work", please? Show a sample of the link ...
7th Dec 2021, 9:48 AM
Ipang
+ 1
Yes, but only for debugging stage, only so you can see clearly, whether the URL built from resultset is valid ...
7th Dec 2021, 9:44 AM
Ipang
+ 1
How the URL look like? I need to see how your code is doing when it builds the URL. Undefined index means there's no such element in the $_GET array, identified by "id1" key.
7th Dec 2021, 9:54 AM
Ipang
+ 1
Ipang oh yes!!!! thank you so much, fixed it already.
7th Dec 2021, 10:16 AM
Azalea
+ 1
Azalea Pls avoid going on private to solve questions. Keeping public makes solutions available to everyone.
7th Dec 2021, 11:31 AM
Emerson Prado
Emerson Prado - avatar
0
Try to dump the URL as text on screen, look for something that doesn't fit in. There seems to be a missing <tr> but that probably was not copied over.
7th Dec 2021, 9:30 AM
Ipang
0
Ipang what do you mean?
7th Dec 2021, 9:30 AM
Azalea
0
I mean, instead of making a hyperlink in the table cell, print the URL on the screen to see if something is not right.
7th Dec 2021, 9:36 AM
Ipang
0
Ipang the href? i will echo it?
7th Dec 2021, 9:37 AM
Azalea
0
I tried running it, only the value of id was retrieved when I use the get method, but the id1 value did not work Ipang
7th Dec 2021, 9:46 AM
Azalea
0
Ipang I have this on my editOrd.php $a =$_GET['id']; $b=$_GET['id1']; echo $a; echo $b; but the b has an error it says undefined index
7th Dec 2021, 9:50 AM
Azalea
0
I wanted to see an exsample of the URL that are printed on screen. Do they form a valid URL? what value does the 'id1' have in the URL; DM isn't working for me, I can only read, not reply ...
7th Dec 2021, 9:59 AM
Ipang
0
Ipang http://localhost/fold/editOrd.php?id=5&id1%20=2
7th Dec 2021, 10:09 AM
Azalea