private_guy Posted July 5, 2007 Share Posted July 5, 2007 Hi there, I want to be able to change PHP Strings e.g.($SITE_NAME=SITE) by using a HTML with PHP form. Okay, here is what I have, my config.php which has all the codes in it, this is my cofig.php file: <? //Config file for ~DSR~ define("SITE","www.someone.com/"); //Site ?> Now I want to know how to make another file called form.php with forms and boxes which can control SITE, but how? Maybe with st_replace? dunno. Please Help. Thanks very much for your help and support. Best Regards, Private_Guy Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 not clear q Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 Sorry, okay, you have the following string: $SITE_NAME which is in the config file, now I want to change that string by a HTML or PHP File (a form). I want to make an admin cp so when the admin wants to change the settings of config.php that he doesn't have to change it from config.php, he could do it by the admin cp. So I want something like that, a form which can change PHP Strings. Now do you understand? Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 If I could contact you via MSN or Yahoo Or Google Messenger, it would be alot easier. So if you could provide me with any of those ID's, that would be great. Thanks Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 i think when varibles are define sample define(here,'heres'); echo here; the result is heres and that constant value to be dynamic use variable as value define(here,'heres');// see this 'heres' change to varianable get it any where db of form is that what you mean? Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 Not really, could I contact you via MSn or Google Or Yahoo? If so, that would be great. Thanks Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 sorry im at the office its forbidden to use such Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 Oh k , then can you make me a form which would be able to change the string $SITE_NAME? Thnx Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 ok where do we get the site name? Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 From config.php as shown above Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 Then listen, why dont you use IRC on #phpfreaks, you could help me out overthere Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 I want to make an admin cp so when the admin wants to change the settings of config.php that he doesn't have to change it from config.php, he could do it by the admin cp. So I want something like that, a form which can change PHP Strings. Now do you understand? <? //db is what you need $query "SELECT * FORM TABLENAMEHERE "; $result=mysql_query($query); // now sample the db has this site while(mysql_fetch_assoc($result)) { define($result['varible name'],$result['site name']); } // so you still need the connection and the db that has description and the sites as the list // sorry if i was wrong? ?> Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 But all my strings are in Config.php not in DB Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 if you want everything to be dynamic the only solution is the db now the sample i gave you will be the config.php and note again you have to create a from that will update ant create record of that db Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 How do I do that? and another question, how do I change DB Strings in PHP? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 first tell me how long you been with php then ill level my answer and provide good sample Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 Not long but I dont really have knowledge on MySQL :S Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 have this as sample im saying it isnt the best but have a best idea out of this <? //sample how to add //note incldude here the db connection if (isset($_POST['Submit'])) { mysql_query("INSERT INTO YOURTBLNAME VALUES(".$_POST['name'].",".$_POST['desc'].")") } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="312" border="1"> <tr> <td colspan="2">this a sample </td> </tr> <tr> <td width="132">name of variable </td> <td width="164"><label> <input type="text" name="name" /> </label></td> </tr> <tr> <td>the site </td> <td><label> <input type="text" name="desc" /> </label></td> </tr> <tr> <td><label> <div align="right"> <input type="submit" name="Submit" value="Submit" /> </div> </label></td> <td><label> <div align="left"> <input type="reset" name="Submit2" value="Reset" /> </div> </label></td> </tr> </table> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
private_guy Posted July 5, 2007 Author Share Posted July 5, 2007 Parse error: parse error, unexpected '}' in add.php on line 9 Line 9: { mysql_query("strings(".$_POST['name'].",".$_POST['desc'].")") } --> Line 9 Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 just add terminator ; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.