Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

href with multiple variables

Codes here !

Moderators: macek, egami, gesf

href with multiple variables

Postby jamiebond » Tue Apr 08, 2014 10:51 pm

Hello, please help.

In a table column I have the following, which works as expected:

Code: Select all
echo "<td><a href = detail_edit.php?id1=".$fldID1." >"."EDIT"."</a></td>";


What I'm asking is; how to redirect to the detail page with TWO id variables:

Example: detail_edit.php?id1=23 AND id2=17

I know it has to be example : detail_edit.php?id1=23&id2=17,

but I don't know how to include that "&id2" section in the php echo code.

I keep messing up the placement of the inverted commas (") and the full stops (.) in the echo.

Please help a newbie.

Thank you kindly.
Jamie.
jamiebond
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Apr 08, 2014 10:18 pm

[SOLVED] href with multiple variables

Postby jamiebond » Wed Apr 09, 2014 2:14 am

[SOLVED]

In case it can help someone else. Correct way is:

Code: Select all
echo '<td><a href="detail_edit.php?id1='.$fldID1.'&id2='.$fldID2.'">EDIT</a></td>';


Thanks anyway.
Jamie.
jamiebond
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Apr 08, 2014 10:18 pm

Re: href with multiple variables

Postby seandisanti » Wed Apr 09, 2014 11:41 pm

There are multiple ways to do what you're trying to do, but duplicate variable names is probably not the best one. you can use json strings to send whole objects or arrays between pages via get variables. Check out json_encode() and json_decode() That way you can even pass an array of arrays with a single field
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron