Jump to content

Recommended Posts

Hi

I have created a favourite link where when you click on the button it adds the game url to a mysql db however there is an error. As well as adding the game url it also adds part of the code which i dont want -

<a href="http://www.rasclerhys.com/ragdollcannonremake.php?">Ragdoll Cannon Remake </a><br /><a href="<?php echo $url; ?>"><?php echo $name; ?></a><br />

That is what appears in the mysql db and i want to get rid of "<a href="<?php echo $url.... "

Here is the favourites code -

<?php

include "config.php";

if($logged[id]){

echo '<div id="gameoptionsmenu"><form name="add" action="addfav.php" method="POST">

<input type="hidden" value="<?php echo $name; ?>" name="fav">

<input type="hidden" value="<?php echo $url; ?>" name="fav2">

<input type="submit" class="submit" value="+ Add To Favourites +">

</form>';

}

?>

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/141495-solved-favourite/
Share on other sites

<?php 
include "config.php";
if($logged[id]){
echo '<div id="gameoptionsmenu"><form name="add" action="addfav.php" method="POST">
<input type="hidden" value="' . $name . '" name="fav">
<input type="hidden" value="' . $url . '" name="fav2">
<input type="submit" class="submit" value="+ Add To Favourites +">
</form>';
}
?>

 

That should do it for you. When you are within an echo statement, you merely need to break and input the variable, as opposed to echoing again.

 

Please use the starting and end [\code] tags in the future.

Link to comment
https://forums.phpfreaks.com/topic/141495-solved-favourite/#findComment-740627
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.