Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Mar 2009
    Location
    Texas
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question How to change things in another file

    Ok well im kind of new to php and im not sure how to do this.

    On many forum sites they have a section where you can edit settings, well im trying to do that. here is a little of what i want to do

    i want to have this on a webpage
    <form.......
    title: <input name="title"......
    text: <input name="text"......
    <input type="submit".......
    </form>
    on one page
    and in a php file it will have stuff like
    <?php
    $title = "The Title";
    $text = "The text goes here";
    ?>
    and if you change the settings in the page with the form it will change the text in between the "" after $title and so on

    Can anyone help me fix this?

  • #2
    Regular Coder
    Join Date
    Mar 2009
    Location
    United Kingdom
    Posts
    161
    Thanks
    6
    Thanked 28 Times in 28 Posts
    Well, in the way your asking, you would have to define in your <form> tag what the method is, so thats either 'post' or 'get' difference between the 2 is that 'get' puts all the info in the address bar whereas 'post' does not, i would recommend using 'post'.

    So change your tag to <form method="post" action="www.example.com">

    In your php have :
    <?
    if(isset($_POST['submitbutton']){
    $title=$_POST['title'];
    $text=$_POST['text'];
    }
    ?>

    that should do what you ask for.

    But i would advise doing it via a database means, as php alone cannot remember setting made, if you want to learn how to use MYSQL (database system) then contact me.
    Last edited by Killermud; 03-16-2009 at 12:44 AM.

  • Users who have thanked Killermud for this post:

    mikemrm (03-16-2009)

  • #3
    New Coder
    Join Date
    Mar 2009
    Location
    Texas
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok ive tried the post thing but ill try it again and i want it to save to a file named like settings.php or whatever so that it will change for everyone who visits it

    Ok and how would we be in contact?
    Ive been trying to setup a mysql database for a couple of weeks now and have had no success if you could help me that would be awsome
    With this form on my forums
    i can change these
    Last edited by mikemrm; 03-16-2009 at 07:20 AM.

  • #4
    Regular Coder
    Join Date
    Mar 2009
    Location
    United Kingdom
    Posts
    161
    Thanks
    6
    Thanked 28 Times in 28 Posts
    Well for the php issue, if you could show all the HTML with names included that would be helpful so i can give the correct php code.

    For MYSQL if you intending to host a database read this :

    http://otfans.net/showthread.php?t=128041


    This is rather complex and time consuming, i would recommend finding a free web hosting service, theres plenty out there or if you are going for something more proffesional buy a web hosting service.

  • #5
    New Coder
    Join Date
    Mar 2009
    Location
    Texas
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ok thanks im going to check out that website and i already have a website that im hosting stuff on but i can only have 300 gb of transfer a month and my clan requires more than that so ive re-routed everything to my own local servers you can check it out www.dzt.mikemrm.com

    So im really trying to get everything running on my own servers.
    thanks again

  • #6
    New Coder
    Join Date
    Mar 2009
    Location
    Texas
    Posts
    25
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ok well i tried the xampp thing and i get this error


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •