Jump to content

Changing PHP Strings By a Form?


private_guy

Recommended Posts

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.