webmaster1 Posted November 28, 2008 Share Posted November 28, 2008 Hi All, I'm passing a value from page 1 to page 2: Page 1: <?php echo "<a href='deldnew.php?geturn=$urn'>DELETE</a>"; ?> Page 2: <?php $geturn=$_GET['geturn']; ?> I use the $geturn value to reference a record to be deleted from a mySQL table. ??? Here's where I'm stuck: I need to pass a second variable whose value is the url of an image to be deleted from the server. ??? Page 2: <?php $myFile = "$getpath"; unlink($myFile); ?> Any ideas on how to pass two variables using the above method? Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/ Share on other sites More sharing options...
revraz Posted November 28, 2008 Share Posted November 28, 2008 Use & after the first one. Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701133 Share on other sites More sharing options...
webmaster1 Posted November 28, 2008 Author Share Posted November 28, 2008 Use & after the first one. Que? Do you mean like so?: a href='deldnew.php?geturn=$urn&getpath=$path' Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701148 Share on other sites More sharing options...
revraz Posted November 28, 2008 Share Posted November 28, 2008 Yep Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701149 Share on other sites More sharing options...
webmaster1 Posted November 28, 2008 Author Share Posted November 28, 2008 Sweet! That works fine, thanks rev! Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701179 Share on other sites More sharing options...
Mchl Posted November 28, 2008 Share Posted November 28, 2008 Just a note: If you want your HTML to be valid, use & instead of & So: <?php echo "<a href='deldnew.php?geturn=$urn&getpath=$path'>DELETE</a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701194 Share on other sites More sharing options...
webmaster1 Posted November 28, 2008 Author Share Posted November 28, 2008 Done and thanks but what would happen ordinarily without the amp? Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701202 Share on other sites More sharing options...
webmaster1 Posted November 28, 2008 Author Share Posted November 28, 2008 This is what I had: <?php echo"<a href='deldnew.php?geturn=$urn&getpath1=$imageurl1&getpath2=$imageurl2&getpath3=$imageurl3'>";?> Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701204 Share on other sites More sharing options...
Mchl Posted November 28, 2008 Share Posted November 28, 2008 Nothing spectacular. You will get an error when trying to validate your page. It's not an error that will make your page inoperable (at least not anytime soon), but you should always try to make your pages so that they validate. Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701206 Share on other sites More sharing options...
webmaster1 Posted November 28, 2008 Author Share Posted November 28, 2008 Gotcha. Great link btw. Quote Link to comment https://forums.phpfreaks.com/topic/134659-solved-passing-two-variables-to-another-page-using-get/#findComment-701215 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.