Posting data with link not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Posting data with link not working

Post by mhouldridge »

Hi,

I am trying to post three bits of data using a hyperlink to another page. Here is the code;

Code: Select all

<?

echo "<td><font color=\"red\"><ahref="addto.htmlasset=$asset&software=$software&license=$license">remove</a> </font></td> \n";

?>
Any ideas why this comes up with a T String error?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Code: Select all

addto.htmlasset=$asset&software=$software&license=$license
:?

What's addto (a constant?) and htmlasset (a constant you're trying to assing a value to?)... it makes no sense... what's it do?

Oh... I see... you're missing escaping quotes if I undertand you correctly.
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Post by mhouldridge »

Sorry, the correct code should have been;

Code: Select all

<? 
echo "<td><font color=\"red\"><a href="addto.html?asset=$asset&software=$software&license=$license">remove</a> </font></td> \n";
?>
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Post by mhouldridge »

I have managed to get this going posting one variable, however with three variables and alternate text "remove", I am not having much luck.

Here is the code which works for the single posting one;

Code: Select all

echo "<TD><font color=\"red\"><b><a href='viewall.php?varl=".$row['asset']."'>".$row['asset']."</a></b></font></TD><TD><font size=\"2\">".$row['title']."</TD><TD><font size=\"2\">".$row['customer']."</TD><TD><font size=\"2\">".$row['type']."</TD><TD><font size=\"2\">".$row['IP']."</TD>\n";
Critta
Forum Newbie
Posts: 8
Joined: Fri Jun 24, 2005 1:45 pm

Post by Critta »

Code: Select all

&lt;?php 
echo &quote;&lt;td&gt;&lt;font color=\&quote;red\&quote;&gt;&lt;a href=\&quote;addto.html?asset=&quote;.$asset.&quote;&amp;software=&quote;.$software.&quote;&amp;license=&quote;.$license&quote;\&quote;&gt;remove&lt;/a&gt; &lt;/font&gt;&lt;/td&gt; \n&quote;;
?&gt;
Should work. Not tested though
Last edited by Critta on Tue Jun 28, 2005 9:29 am, edited 1 time in total.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Hint... please look at our syntax highlighting when you post your code...

Strings should be red.., constants, variables, and functions blue, delimiters green.

Yours is all blue which tell you something about the string....
Critta
Forum Newbie
Posts: 8
Joined: Fri Jun 24, 2005 1:45 pm

Post by Critta »

wassup with mine, what have I done wrong to make it all green?

d11wtq | Dunno what you're talking about LOL :lol: - Joking... you used

Code: Select all

tags... we have

Code: Select all

tags [/color]
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

You may need to use urlencode if your variables contain special characters.
Critta
Forum Newbie
Posts: 8
Joined: Fri Jun 24, 2005 1:45 pm

Post by Critta »

d11wtq wrote:Dunno what you're talking about LOL :lol: - Joking... you used

Code: Select all

tags... we have

Code: Select all

tags [/color][/quote]

It's always something blindingly obvious isn't it, cheers
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Post by mhouldridge »

Hi,

This is what I have now;

Code: Select all

<? 
$remove = "remove";
echo "<a href='removeandstore.php?varl=".$row['asset']."'>".$remove."</a> \n"
?>
On the removeandstore.php page I have two text boxes, one software and the other license. Currently this will only display the value for that field;

I have used the following to show parts of the asset on the removeandstore.php;

Code: Select all

<? echo $formVars["software"]; ?>
My first page has numerous ssoftwares and licenses show, each with it's own remove link. I want the data from each software and license to be posted to the removeandstore.php page. Do I simply use the "&" symbol for this?

thanks
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Post by mhouldridge »

Here is my updated code;

Code: Select all

<? 
$remove = "remove";
echo "<a href='removeandstore.php?varl=".$formVars['software']."&var2=".$formVars['license']."'>".$remove."</a> \n"
?>
Post Reply