Jump to content

[SOLVED] global help?


adamlacombe

Recommended Posts

I have this code:

<?php
function centercontent() {
global $mtd_members, $mtd_favorites, $mtd_feedback, $mtd_addfav, $mtd_login;

if($_POST['submit']){
   $members=clean_up($_POST['members']);
   $favorites=clean_up($_POST['favorites']);
   $feedback=clean_up($_POST['feedback']);
   $addfav=clean_up($_POST['addfav']);
   $login=clean_up($_POST['login']);
   $logout=clean_up($_POST['logout']);
   $messages=clean_up($_POST['messages']);
   $profile=clean_up($_POST['profile']);
   $register=clean_up($_POST['register']);
   $search=clean_up($_POST['search']);
   $game=clean_up($_POST['game']);
   $browsegame=clean_up($_POST['browsegame']);
   $joke=clean_up($_POST['joke']);
   $browsejoke=clean_up($_POST['browsejoke']);
   $video=clean_up($_POST['video']);
   $browsevideo=clean_up($_POST['browsevideo']);
   $user_avatar=clean_up($_POST['user_avatar']);
   $user_index=clean_up($_POST['user_index']);
   $user_comments=clean_up($_POST['user_comments']);
   $user_profilecp=clean_up($_POST['user_profilecp']);
   $user_password=clean_up($_POST['user_password']);
   $user_addjoke=clean_up($_POST['user_addjoke']);
   $user_editjoke=clean_up($_POST['user_editjoke']);
   $user_addvideo=clean_up($_POST['user_addvideo']);
   $user_editvideo=clean_up($_POST['user_editvideo']);
   $admin_index=clean_up($_POST['admin_index']);
   $admin_favicon=clean_up($_POST['admin_favicon']);
   $admin_comments=clean_up($_POST['admin_comments']);
   $admin_feedback=clean_up($_POST['admin_feedback']);
   $admin_users=clean_up($_POST['admin_users']);
   $admin_settings=clean_up($_POST['admin_settings']);
   $admin_addgame=clean_up($_POST['admin_addgame']);
   $admin_addgamecat=clean_up($_POST['admin_addgamecat']);
   $admin_gamecats=clean_up($_POST['admin_gamecats']);
   $admin_editgames=clean_up($_POST['admin_editgames']);
   $admin_addjoke=clean_up($_POST['admin_addjoke']);
   $admin_addjokecat=clean_up($_POST['admin_addjokecat']);
   $admin_jokecats=clean_up($_POST['admin_jokecats']);
   $admin_editjokes=clean_up($_POST['admin_editjokes']);
   $admin_addvideo=clean_up($_POST['admin_addvideo']);
   $admin_addvideocat=clean_up($_POST['admin_addvideocat']);
   $admin_videocats=clean_up($_POST['admin_videocats']);
   $admin_editvideos=clean_up($_POST['admin_editvideos']);

mysql_query("UPDATE meta_tags_descriptions SET 
`members`='$members',  
`favorites`='$favorites', 
`feedback`='$feedback', 
`addfav`='$addfav', 
`login`='$login', 
`logout`='$logout', 
`messages`='$messages', 
`profile`='$profile', 
`register`='$register', 
`search`='$search', 
`game`='$game', 
`browsegame`='$browsegame', 
`joke`='$joke', 
`browsejoke`='$browsejoke', 
`video`='$video', 
`browsevideo`='$browsevideo', 
`user_avatar`='$user_avatar', 
`user_index`='$user_index', 
`user_comments`='$user_comments', 
`user_profilecp`='$user_profilecp', 
`user_password`='$user_password', 
`user_addjoke`='$user_addjoke', 
`user_editjoke`='$user_editjoke', 
`user_addvideo`='$user_addvideo', 
`user_editvideo`='$user_editvideo', 
`admin_index`='$admin_index', 
`admin_favicon`='$admin_favicon', 
`admin_comments`='$admin_comments', 
`admin_feedback`='$admin_feedback', 
`admin_users`='$admin_users', 
`admin_settings`='$admin_settings', 
`admin_addgame`='$admin_addgame', 
`admin_addgamecat`='$admin_addgamecat', 
`admin_gamecats`='$admin_gamecats', 
`admin_editgames`='$admin_editgames', 
`admin_addjoke`='$admin_addjoke', 
`admin_addjokecat`='$admin_addjokecat', 
`admin_jokecats`='$admin_jokecats', 
`admin_editjokes`='$admin_editjokes', 
`admin_addvideo`='$admin_addvideo', 
`admin_addvideocat`='$admin_addvideocat', 
`admin_videocats`='$admin_videocats', 
`admin_editvideos`='$admin_editvideos' 
where id='1'") or die(mysql_error());
echo '<div class="done">Settings updated</div><br />';
}

echo "<div class='header'>Meta Descriptions</div>";

echo'<form action="admin.php?action=metadesc" method="POST"><table width="100%">

<tr>
<td class="content"><b>Members:</b></td>
<td class="content"> <textarea cols="35" rows="3" name="members">'.$mtd_members.'</textarea></td>
</tr>

<tr>
<td class="content"><b>Favorites:</b></td>
<td class="content"> <textarea cols="35" rows="3" name="favorites">'.$mtd_favorites.'</textarea></td>
</tr>

<tr>
<td class="content"><b>Feedback:</b></td>
<td class="content"> <textarea cols="35" rows="3" name="feedback">'.$mtd_feedback.'</textarea></td>
</tr>

<tr>
<td class="content"><b>Add Favorite:</b></td>
<td class="content"> <textarea cols="35" rows="3" name="addfav">'.$mtd_addfav.'</textarea></td>
</tr>

<tr>
<td class="content"><b>Login:</b></td>
<td class="content"> <textarea cols="35" rows="3" name="login">'.$mtd_login.'</textarea></td>
</tr>

</table>
<table width="100%">
<tr><td width="85%" class="content"></td>
<td width="15%" align="right" class="content"><input type="submit" name="submit" id="submit" value="Change!"></td></tr>
</form></table>';

};

$title="Meta Tag Description";
?>

 

But the only textareas I am getting any text from are the first two, and I know that all the others should be displaying text.

 

The variables are coming from this code here:

<?php
$mtd=mysql_query("SELECT * from meta_tags_descriptions where id='1'") or die(mysql_error());
$metadesc=mysql_fetch_array($mtd);
$mtd_members=$metadesc[members];
$mtd_favorites=$metadesc[favorites];
$mtd_feedback=$metadesc[feedback];
$mtd_addfav=$metadesc[addfav];
$mtd_login=$metadesc[login];
?>

 

So any idea on how come the other 3 wont display?

 

Thanks in advanced,

Adam

Link to comment
https://forums.phpfreaks.com/topic/171984-solved-global-help/
Share on other sites

Either there is nothing in the database for those fields, there is an error in your code such as a typo in the field names or you have some code that is overwriting those variables, or the contents of those contains HTML special characters that cause the contents to appear in the "view source" of the page but is it is not rendered in the output on the page.

 

Have you done a "view source" of the page in your browser? Are you developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your php.ini (stop and start your web server to get any change made to php.ini to take effect and confirm the values using a phpinfo() statement.) And have you examined the data directly in your database tables so that you know there is something there?

Link to comment
https://forums.phpfreaks.com/topic/171984-solved-global-help/#findComment-906854
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.