Why can't I pass value via url in php? | Sololearn: Learn to code for FREE!

+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

12/7/2021 6:27:41 AM

Azalea

14 Answers

New Answer

+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 ...

+2

Explain "did not work", please? Show a sample of the link ...

+1

Yes, but only for debugging stage, only so you can see clearly, whether the URL built from resultset is valid ...

+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.

+1

Ipang oh yes!!!! thank you so much, fixed it already.

+1

Azalea Pls avoid going on private to solve questions. Keeping public makes solutions available to everyone.

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.

0

Ipang what do you mean?

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.

0

Ipang the href? i will echo it?

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

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

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 ...

0

Ipang http://localhost/fold/editOrd.php?id=5&id1%20=2