Jump to content

newb

Members
  • Posts

    454
  • Joined

  • Last visited

Everything posted by newb

  1. hmm, the html outputs this: [code] <select name='sex'> <option value='Male' selected='selected' >Male</option> <option value='Female' selected='selected' >Female</option> </select> [/code] any help would be wonderful thankz
  2. i have this code for changing ur gender (if ur a male or female). it changes the value in the database but it doesnt display if ur chosen gender. help pleeze [code] <?php $query = $config->query("SELECT * FROM $table_users WHERE username='$_SESSION[username]'"); $row = mysql_fetch_array($query); $sex = array ( 0 => 'Male', 1 => 'Female', ); echo "<select name='sex'>"; if ( (in_array("$row[sex]", $sex)) ) { $selected = "selected='selected'"; } else { $selected = NULL; } $option = " <option value='$sex[0]' $selected >$sex[0]</option>\n <option value='$sex[1]' $selected >$sex[1]</option>\n"; echo $option; echo "</select>"; ?> [/code]
  3. [code] <?php   $query = $config->query("SELECT * FROM table_modules");             echo "<select name='conf_default_mod'>"; while ($row = mysql_fetch_array($query)) { $option = "\n<option value='$row[id]'>$row[name]</option>\n"; $query2 = $config->query("SELECT * FROM table_settings WHERE id='11'"); $row2 = mysql_fetch_array($query2); $def_mod = $row2['value']; if(eregi("$def_mod",$option)) { $option = str_replace($option,"\n<option value='$row[id]' selected='selected'>$row[name]</option>\n",$option); } else { $option = "\n<option value='$row[id]'>$row[name]</option>\n"; } echo $option; }             echo "           </select>"; ?> [/code] incase anyone wanted to know how it was done
  4. didnt work., i dont have a $row'is_selected' field in my table.
  5. [code] <?php   $query = $config->query("SELECT * FROM table_modules");             echo "<select name='conf_default_mod'>"; while ($row = mysql_fetch_array($query)) { echo "\n<option value='$row[id]'>$row[name]</option>\n"; }             echo "           </select>    ?> [/code] how do i change the code so that it echo's whatever option is selected in the database. like selected="selected" . any one know how?
  6. if a string contains html code, how do you output without it? for example: [code] <?php $string = "<b>hi</b>"; echo $string; ?> [/code] the string wont be bold, it will just be 'hi' without the bolding.
  7. thx. i revised it a bit so it checks if the user inputs just www.google.com or google.com [code] <?php if (!strstr($url,'http://')) { if (strstr($url,'www')) { $url = 'http://'.$url; } else {     $url = 'http://www.'.$url;   } } ?> [/code]
  8. how do i convert google.com or if the user inputs www.google.com to http:// or if they already have http:// it wont add the extra http:// like in vbulletin?? does anyone know how i been trying to figure it out i dont kno how to do it someone pleeze give me example pls help thanks im new at php idk where 2 start.
  9. yeah but im saying like, what usergroups do you use in the table
  10. how do u do ur usergroup permissions for if ur making a forum or cms. like root, admin, member?? or is there something more
  11. Ohh ok, thanks alot. and yes, im new to functions and classes so that helped a bunch
  12. ur using the right php syntax so make sure its the right path and if it is then its something with the server ur on
  13. eh how come this happens... the code doesn't echo what variable 'a' is set to..why?... [code] <?php class variable { function loadvars() { $a = 'lol'; } function newfunction() { $this->loadvars(); echo $a; } } $variable = new variable(); $variable->newfunction(); ?>[/code]
  14. lmfao. it worked fine for me rofl.
  15. but i used it before and it worked as if i was using !== :/
  16. i didnt ask the difference between !== and !=... i asked the difference between !== and ==!... lol.
  17. [quote author=Jenk link=topic=109608.msg442501#msg442501 date=1159377591] newb, you start the dicussion. [/quote] i already did.
  18. [quote author=Daniel0 link=topic=109608.msg442449#msg442449 date=1159372398] Do you want to discuss wether it's good or bad to use OOP? [/quote] affirmative.
×
×
  • 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.