Hi, I have this website where there will be chat rooms. I would like to have a form(php script) of rules of conduct before people gets access to the chat rooms. The options: Yes to continue to the chat rooms, No to send them back to the Home page.
Thanks in advance for you help.

Fernando

Recommended Answers

All 6 Replies

hello,

Please describe your question clearly..
or this is what you are searching...

<form name="confirm" method="post">
Do You want to continue to enter  into chat room?<br>
<br />
<input type="radio" name="confirm" value="1"> Yes<br>
<input type="radio" name="confirm" value="2"> No<br>

<input type="submit" value="Submit" onclick="get_radio_value()">
</form>

<script type="text/javascript">
function get_radio_value()
{
var val=0;
for (var i=0; i < document.confirm.confirm.length; i++)
   {
   if (document.confirm.confirm[i].checked)
   {
      	var val=document.confirm.confirm[i].value;
   }
   }
    if(val == 2)
   	window.location="home.php";
	else if(val == 1)
	window.location="chatrooms.php";
	else
	{
		alert("Please Confirm!!");
		return false;
	}
}
</script>

Reply with your queries with clear information..

Thanks for your prompt response.
I have this site with a menu that gives the user the option to click the link to open the chat room, rather that going directly in the chat room I want to show the user a page with rules of conduct in the chat room, and give the user the option to press YES (agreeing to the rules of conduct in the chat rooms)allowing the user into the chat room or press NO (not agreeing to the rules therefore going back to the main page of the site to continue browsing)

The code that you put in your response, seems to be close to what I am looking for, but when I attempted to run the code it did not work. Would you please post the complete code? thank you

<!-- Rules of conduct text here -->

<center>
<div style="width: 300px; text-align: center;">
Do you agree to the rules?
<br />
<button onclick="location.replace('chatroom.php')">Yes</button>
&nbsp;&nbsp;
<button onclick="location.replace('home.php')">No</button>
<br />
</div>
</center>

This might work for you.

I think this might the solution. Is this the entire script?
thanks

Pretty much, other than formatting the page and maybe adding a background and border.

Now please bear in mind that this snippet has *zero* security measures and all a person would have to do is enter the url of the chatroom to bypass this screen.

I will give it a try. Thanks for all your help.

Fernando

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.