Jump to content

Archived

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

radar

Image Buttons and Cases

Recommended Posts

Okay so for this part of my site..  I have opted to use image buttons just for the visual appeal -- and they fit better..

Now I read somewhere that the image button names get appended or something in posting..  How can I tell what has been appended onto the name so that I can get my cases working properly?

In fact since on all my pages ive got a errmsg on it.. I tried setting that to show the name of the button...  which i do through this code

$tpl->assign('errmsg', $_POST[Submit]); which should give me what I am looking for should it not? but when I click on the image buttons it does not work.. though when I click on the other button thats on my this page an add button -- it does work...  Any clue as to why? here is my coding thus far on this.. This code is just for the links page alone... 

[code]
<?php
case links :
if ($row['sub_class'] == "Root") {
$tpl->define(array(foo => "admin/main.tpl", bar => "admin/left_root.tpl", body => "admin/body_admin.tpl", link=> "admin/links.tpl"));
}
if ($row['sub_class'] == "Site") {
$tpl->define(array(foo => "admin/main.tpl", bar => "admin/left_site.tpl", body => "admin/body_admin.tpl", link=> "admin/links.tpl"));
}
if ($row['sub_class'] == "Forum") {
$tpl->define(array(foo => "admin/main.tpl", bar => "admin/left_forum.tpl", body => "admin/body_admin.tpl", link=> "admin/links.tpl"));
}
$all = mysql_fetch_assoc(mysql_query("SELECT * FROM links"));
$tpl->assign('errmsg', $_POST['Submit']);
switch ($_POST['Submit']) {
default :
$queued = "SELECT * FROM links WHERE links_status = 'queued'";
$queued = mysql_query($queued);
$cnt = mysql_num_rows($queued);
if ($cnt == "" || $cnt == "0") {
$tpl->assign('queued_link_list', '<tr><td width="100%" bgcolor="#FFFFFF" class="style7">There are 0 links waiting in queue</td></tr>');
} else {
for ($i = 0; $i < $cnt && $rows = mysql_fetch_assoc($queued); $i++) {
$link_url = $rows['link_url'];
$link_image = $rows['link_image'];
$link_name = $rows['link_name'];
$link_id = $rows['links_id'];
if ($link_image == "") {
$list .= '<tr>
            <td width="331" bgcolor="#FFFFFF" class="style7"><a href="'.$link_url.'">'.$link_url.'</a></td>
            <td width="172" bgcolor="#FFFFFF" class="style7">no image specified</td>
            <td width="205" bgcolor="#FFFFFF" class="style7">'.$link_name.'
              <input name="queued_links" type="hidden" id="queued_links" value="'.$link_id.'" /></td>
            <td width="44" bgcolor="#FFFFFF"><input type="submit" src="../templates/cesite/images/b_edit.gif" name="Submit" alt = "approve" value="approve" /><input type="submit" src="../templates/cesite/images/b_drop.gif"  alt = "deny" name="Submit" value="deny" /></td>
          </tr>';
} else {
$list .= '<tr>
            <td width="331" bgcolor="#FFFFFF" class="style7"><a href="'.$link_url.'">'.$link_url.'</a></td>
            <td width="172" bgcolor="#FFFFFF" class="style7"><a href="'.$link_image.'">selected image</a></td>
            <td width="205" bgcolor="#FFFFFF" class="style7">'.$link_name.'<input name="queued_links" type="hidden" id="queued_links" value="'.$link_id.'" /></td>
            <td width="44" bgcolor="#FFFFFF"><input type="submit" src="../templates/cesite/images/b_edit.gif" name="Submit" value="approve" /><input type="submit" src="../templates/cesite/images/b_drop.gif" name="Submit" value="deny" /></td>
          </tr>';
  }

}
$tpl->assign('queued_link_list', $list);
}
break;

case approve :
$tpl->assign('errmsg', 'We are approving the site');
break;

}

?>
[/code]

Share this post


Link to post
Share on other sites
If you have a submit button thats an image, I belive you'll need to use $_POST['Submit_x'] or $_POST['Submit_y'] as the browser sends the the x and y co-ordinates where the user click the submit button.

Share this post


Link to post
Share on other sites
Oh -- so is there any way to get an absolute value out of this method or should i go back to just images set as links to go to index.php?act=links&whatever=whatever

Just thought since the rest of my site only has the act= part i'd try to stick with that.. but seems like thats not going to happen

Share this post


Link to post
Share on other sites

×

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.