3 Replies - 729 Views - Last Post: 10 August 2008 - 06:29 PM Rate Topic: -----

#1 dilemmalurve  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 22-June 08

URGENT! DISABLING SUBMIT BUTTON

Post icon  Posted 05 August 2008 - 08:09 PM

HI! I need help in disabling the submit button so the user cannot join the contest that he created. but can enable other users to click on it.

THIS PART OF THE CODE WORKS FOR ENABLING. GO_THERE IS A POPOUT BOX FUNCTION.


echo "<input type='submit' value='Select Contest' name='Submit' onclick='go_there()'/></tr>";

<script language="Javascript">
<!--
function go_there()
{
 var where_to= confirm("Do you really want to participate??");
 if (where_to== true)
 {
   window.location="http://www.paypercontest.com/testing/chosen_contest.php?CON_ID=<?php echo $CON_ID;?>&CON_TITLE=<?php echo $con_title?>";
   
 }
 else
 {
  window.location="http://www.paypercontest.com/testing/marketplace.php";
  }
}
//-->
</SCRIPT>





May i know how to add in the disabling part by checking username? Thanks.

xoxo,
g

Is This A Good Question/Topic? 0
  • +

Replies To: URGENT! DISABLING SUBMIT BUTTON

#2 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5394
  • View blog
  • Posts: 27,389
  • Joined: 10-May 07

Re: URGENT! DISABLING SUBMIT BUTTON

Posted 05 August 2008 - 08:13 PM

From this code alone, I'm not sure how you get their username, but guessing that $UserName is the variable name :
if($UserName!="Guy_You_want_toBlock") {
  echo "<input type='submit' value='Select Contest' name='Submit' onclick='go_there()'/></tr>";
}



Or you could do it by ip address.

if($_SERVER['REMOTE_ADDR']!=192.168.0.1) { // <-- You will need to know his ISP assigned ip address
  echo "<input type='submit' value='Select Contest' name='Submit' onclick='go_there()'/></tr>";
}


Was This Post Helpful? 0
  • +
  • -

#3 dilemmalurve  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 22-June 08

Re: URGENT! DISABLING SUBMIT BUTTON

Posted 05 August 2008 - 08:42 PM

HAH, thanks for your promt reply. (:

Oh let me go into depth, contest is a table whereby user puts in contests, contestants table is a table where people joins contest. Im using cookie to track who logged in.
So i want something like if the cookie = person who puts up the contest != disable button

But i cant seem to know how to phrase it! :angry: I need your help! thanks! (:

g

This post has been edited by dilemmalurve: 05 August 2008 - 08:45 PM

Was This Post Helpful? 0
  • +
  • -

#4 dilemmalurve  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 22-June 08

Re: URGENT! DISABLING SUBMIT BUTTON

Posted 10 August 2008 - 06:29 PM

Hi all, i need help to spot the errors!


if($username!= '$_COOKIE[ID_my_site]') {

echo "<input type='submit' id='submit' type='submit' value='Select Contest' name='Submit' onclick='go_there()'/></tr>";
}
else{

echo "<input type='submit' id='submit' type='submit' value='Select Contest' name='Submit' onclick='setTimeout('disableButton()', 1) '/></tr>";
}

echo "</table>";

?>
</p>

<!--<form id="form1" name="form1" action="chosen_contest.php" method="post">
<a href="Success_join.php?CON_TITLE='.$row['CON_TITLE'].'"></a>
  <p>&nbsp;</p>
</form>-->


<script language="Javascript"><![CDATA[										  
function disableButton() {
var domNode = document.getElementById('form1:submit')
domNode.setProps({disabled: true});
}]]></script>



<script language="Javascript">
<!--
function go_there()
{
 var where_to= confirm("Do you really want to participate??");
 if (where_to== true)
 {
   window.location="http://www.payC.com/testing/chosen_contest.php?CON_ID=<?php echo $CON_ID;?>&CON_TITLE=<?php echo $con_title?>";
   
 }
 else
 {
  window.location="http://www.payC.com/testing/marketplace.php";
  }
}





the 1st javascript would disable button when contest's username is same as username.

the 2nd would show a pop out box when click and forward the user to another page.

HELP!! ):

This post has been edited by dilemmalurve: 10 August 2008 - 06:31 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1