Jump to content

A small problem


DJ24966

Recommended Posts

Ok, after getting the rest of my issues fixed thanks you guys, I was wondering if you could help out with 1 last thing. We have incorporated categories to our chat site to keep things organized.

 

In the past, the user could just input the room name and join, no problem all worked well. Here is the code we used then.

<b>Create a Chat:</b><br>
<form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx">
    <input type="hidden" name="member" value="XS803m">
  Room: <input name="value" type="text"><br>
  <input type="submit" value="Create">
</form>

 

No, how could I make the following.

I need the category to show up directly after the channel.aspx, so, an example would be.

 

http://chatterupchat.webhop.org/chat/channel.aspx?value=[GN]TheLobby&member=XS803m

 

Here is the code I have no, which obviously, does not work

 

<b>Create a Chat:</b><br>
<form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx">
    <input type="hidden" name="member" value="XS803m">
  Room: <input name="value" type="text"><br>
  Category: <select name="cat">
<option value="[CP]">Computing</option>
<option value="[EN]">Entertainment</option>
<option value="[GN]">General</option>
<option value="[iE]">Interests</option>
<option value="[NP]">News & Politics</option>
<option value="[RO]">Romance</option>
<option value="[RE]">Religion</option>
<option value="[PE]">Peers</option>
<optoin value="[sP]">Sports & Recreation</option>
<option value="[TE]">Teens</option>
</select>
  <input type="submit" value="Create">
</form>

 

Any help would be highly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/
Share on other sites

i new you was hankering for someone to do it for you lol

 

first change your form to to this

<form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx">
    <input type="hidden" name="member" value="XS803m">
  Room: <input id="value" name="value" type="text"><br>
  Category: <select id="cat" name="cat">
<option value="[CP]">Computing</option>
<option value="[EN]">Entertainment</option>
<option value="[GN]">General</option>
<option value="[iE]">Interests</option>
<option value="[NP]">News & Politics</option>
<option value="[RO]">Romance</option>
<option value="[RE]">Religion</option>
<option value="[PE]">Peers</option>
<optoin value="[sP]">Sports & Recreation</option>
<option value="[TE]">Teens</option>
</select>
  <input type="submit" value="Create" onclick="buildCat()">
</form>

 

put this is the head

 

<script type="text/javascript">
<!--
function buildCat() {
   var selD = document.getElementById('cat');
   var selI = selD.options[selD.selectedIndex].value;
   
   document.getElementById('value').value = selI;
//-->
</script>

 

if computting was selected this will output http://chatterupchat.webhop.org/chat/channel.aspx?member=XS803m&value=[CP]

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691730
Share on other sites

See, I could have gotten it to do that, but thats not whats needed.

 

I need the [CP] or whatever cat to appear infront of the room name, like this.

 

http://chatterupchat.webhop.org/chat/channel.aspx?value=[GN]TheLobby&member=XS803m

 

Otherwise, it will not place the channel into a category like I would like for it to.

 

Sorry for the confusion

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691733
Share on other sites

use this script then

<script type="text/javascript">
<!--
function buildCat() {
   var selD = document.getElementById('cat');
   var selI = selD.options[selD.selectedIndex].value;
   var selT = selD.options[selD.selectedIndex].text;
   var buLi = selI+selT; 
   
   document.getElementById('value').value = buLi;
//-->
</script>

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691736
Share on other sites

oh i see what you mean now

<form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx">
    <input type="hidden" name="member" value="XS803m" />
    <input type="hidden" name="value" id="value" value="" />
  Room: <input id="room" name="room" type="text"><br>
  Category: <select id="cat" name="cat">
<option value="[CP]">Computing</option>
<option value="[EN]">Entertainment</option>
<option value="[GN]">General</option>
<option value="[iE]">Interests</option>
<option value="[NP]">News & Politics</option>
<option value="[RO]">Romance</option>
<option value="[RE]">Religion</option>
<option value="[PE]">Peers</option>
<optoin value="[sP]">Sports & Recreation</option>
<option value="[TE]">Teens</option>
</select>
  <input type="submit" value="Create" onclick="buildCat()">
</form>

<script type="text/javascript">
<!--
function buildCat() {
   var selD = document.getElementById('cat');
   var selI = selD.options[selD.selectedIndex].value;
   var selT = document.getElementById('room').text;
   var buLi = selI+selT; 
   
   document.getElementById('value').value = buLi;
//-->
</script>

[/code

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691739
Share on other sites

hmm, both ways I'm still getting the same URL with the same results.

 

http://chatterupchat.webhop.org/chat/channel.aspx?member=XS803m&value=&room=Test&cat=[iE]

 

I've been having the same issue, everything I have tried resulted in that. When this is what I need it to look like.

 

http://chatterupchat.webhop.org/chat/channel.aspx?value=[iE]Test&member=XS803m

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691743
Share on other sites

Well that funny on my part, i missed the final } in the javascript.. doh

 

so try this as you JS

<script type="text/javascript">
<!--
function buildCat() {
   var selD = document.getElementById('cat');
   var selI = selD.options[selD.selectedIndex].value;
   var selT = document.getElementById('room').value;
   var buLi = selI+selT; 
   
   document.getElementById('value').value = buLi;
}
//-->
</script>

 

and this as your form

 

<form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx">
    <input type="hidden" name="value" id="value" value="" />
    <input type="hidden" name="member" value="XS803m" />    
  Room: <input id="room"  type="text"><br>
  Category: <select id="cat">
<option value="[CP]">Computing</option>
<option value="[EN]">Entertainment</option>
<option value="[GN]">General</option>
<option value="[iE]">Interests</option>
<option value="[NP]">News & Politics</option>
<option value="[RO]">Romance</option>
<option value="[RE]">Religion</option>
<option value="[PE]">Peers</option>
<optoin value="[sP]">Sports & Recreation</option>
<option value="[TE]">Teens</option>
</select>
  <input type="submit" value="Create" onclick="buildCat()">
</form>

 

 

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691762
Share on other sites

Well that funny on my part, i missed the final } in the javascript.. doh

 

so try this as you JS

<script type="text/javascript">
<!--
function buildCat() {
   var selD = document.getElementById('cat');
   var selI = selD.options[selD.selectedIndex].value;
   var selT = document.getElementById('room').value;
   var buLi = selI+selT; 
   
   document.getElementById('value').value = buLi;
}
//-->
</script>

 

and this as your form

 

<form method="GET" action="http://chatterupchat.webhop.org/chat/channel.aspx">
    <input type="hidden" name="value" id="value" value="" />
    <input type="hidden" name="member" value="XS803m" />    
  Room: <input id="room"  type="text"><br>
  Category: <select id="cat">
<option value="[CP]">Computing</option>
<option value="[EN]">Entertainment</option>
<option value="[GN]">General</option>
<option value="[iE]">Interests</option>
<option value="[NP]">News & Politics</option>
<option value="[RO]">Romance</option>
<option value="[RE]">Religion</option>
<option value="[PE]">Peers</option>
<optoin value="[sP]">Sports & Recreation</option>
<option value="[TE]">Teens</option>
</select>
  <input type="submit" value="Create" onclick="buildCat()">
</form>

 

Thanks again, and yeah, I noticed that as well.

 

All is working! Once I get everything done, I will include this site in the credits for helping us out.

 

I really do appreciate it.

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691764
Share on other sites

<script type="text/javascript">
<!--
function buildCat() {
   var selD = document.getElementById('cat');
   var selI = selD.options[selD.selectedIndex].value;
   var selT = document.getElementById('room').value;
   var sRE = selT.replace(/ /g,"_");
   var buLi = selI+sRE; 
   
   document.getElementById('value').value = buLi;
}
//-->
</script>

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-691983
Share on other sites

<script type="text/javascript">
<!--
function buildCat() {
   var selD = document.getElementById('cat');
   var selI = selD.options[selD.selectedIndex].value;
   var selT = document.getElementById('room').value;
   var sRE = selT.replace(/ /g,"_");
   var buLi = selI+sRE; 
   
   document.getElementById('value').value = buLi;
}
//-->
</script>

 

Awesome man, Thank you so much. I guess it was you who was in a room yesterday? I didn't have mine opened up, it was minimized and I didn't see it till last night.

Link to comment
https://forums.phpfreaks.com/topic/132998-a-small-problem/#findComment-692152
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.