Help with link to post two bits of data to page

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

Help with link to post two bits of data to page

Post by mhouldridge »

Hi,

I have a php page that displays mysql data within text fields for a particular record.

The two fields I have are;

Code: Select all

<? echo $formVars["software"]; ?>
<? echo $formVars["license"]; ?>
Within the page this displays the software and license for a specific asset.

I would like to add a remove text link at the side of these elements which post to another page for storing purposes so that in the future people can see what software has been deleted from the system.

Any ideas, here is what I have;

Code: Select all

<? 
$datalink = $formVars["software"] & $formVars["license"];
$link = $datalink;
$post = 'http://www.audit.giacom.com/addto.php'; //d11wtq | added quotes you were missing 
$submit = PHPlink aref = $post;
echo $submit
?>
No I know the above is absolutely incorrect, but I am a noob to this and I think the structure is near.

thanks,
Mark


User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I'm a little unclear as to what you want. Do you want to attach those variables to the link in order to pass the information? If so, you can just attach the data as GET variables:

Code: Select all

<a href = &quote;addto.html?software=$software&license=$license&quote;>
However, if you're doing that, I'd suggest serializing it beforehand (look at serialize()).

Ultimately though, I'd strongly suggest making a small form and POSTing the data to your new page, rather than just using a simple link. Making a form rather than a link will stop some people from just typing in the URL of the page and putting their variables in the URL. It's a little harder to spoof a POST.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Post by mhouldridge »

Hi,

Yes - that is the way I would like to do it. The page is secure and is not used for public access so spoofing wont be a problem.

I would like to display the link as remove. How would I do this, I know this sounds daft but I am a complete noob to this.

thanks for your help so far!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Something like this should work:

Code: Select all

<a href = &quote;remove.html?software=$software&license=$license&quote;>
Remove
</a>
I'd still recommend serializing and unserializing the data though, if there's a chance special characters might be present - such as ? and & in particular.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply