Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Can this be done?

  • 01-01-2003 6:53pm
    #1
    Registered Users, Registered Users 2 Posts: 9,604 ✭✭✭


    i want to create a page in php that will update itself when people post information from a form.

    E.g Fill in form. Form goes to file on server. Say a text file. Text is updated. PHP reads from text file and updates the page.

    Any ideas how this can be done?

    The parts that are hard are getting the form posting information to a text file.

    I could use a database but how would i get the form to post to a database and how would i get php to read from it. I have MYsql on my host server.

    Would it be easier with a database.

    Thank you

    Anyone know where i can get Microsoft IIS so i can test sites on my own computer.


Comments

  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    Easily done iirc. A database may be neater than a text file.

    The entire page would be written in PHP, including the part with the form, so when the person hits submit, the entire page refreshes itself and can either use the data submitted into the form directly, or you can save it, and use it on the refreshed page.

    To check your own stuff at home, download apache for windows and install the php module.

    www.apache.org
    www.php.net

    It's quite simple and the sites give great walkthroughs :)


  • Closed Accounts Posts: 287 ✭✭donaloconnor


    form with a field name called "text" and method is post to say submit.php


    submit.php::::

    mysql_connect("serveraddress","user","pass")
    or die("Unable To Connect<BR><BR>");
    mysql_select_db("databasename") or die ("Unable To Load Database<BR><BR>");


    if ($text) {

    //if field contains text

    $submitquery = "INSERT INTO `table` (`text`) VALUES ('$text');";

    mysql_query ($submitquery);

    }

    else {

    //if contains no text

    print ("Error - You Did Not Enter Any Text");

    }







    and thats about it :)


  • Registered Users, Registered Users 2 Posts: 9,604 ✭✭✭irishgeo


    Thank you.

    I got it working and also got a script to output the database to a html table.

    Where can i get a script that will check people have entered the correct information.


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta




  • Closed Accounts Posts: 287 ✭✭donaloconnor


    www.hotscripts.com is your second friend :D


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 9,604 ✭✭✭irishgeo


    i got it to work for one field but how to i get it to work for 4 fileds and have them all inserted into the one row in a table.

    Please help

    The filed names are Name,Position,Club and nationality

    Please help


    can you also tell me how to go back to the players page after the data has been submitted to show the updated entry


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by irishgeo
    i got it to work for one field but how to i get it to work for 4 fileds and have them all inserted into the one row in a table.
    ffs, someone already posted the code used for inserting data into a DB above, it's not that difficult to adapt it:
    [PHP]
    $submitquery = "INSERT INTO `table` (`text`) VALUES ('$text');";

    mysql_query ($submitquery);
    [/PHP]
    can you also tell me how to go back to the players page after the data has been submitted to show the updated entry
    Use [PHP]header ("Location: players.php");[/PHP] to send them back to players.php. Be sure not to output anything other than headers when you do this.


  • Closed Accounts Posts: 287 ✭✭donaloconnor


    [PHP]

    $submitquery = "INSERT INTO `table` (`text`, `textfield2`, `textfield3`, `textfield4`) VALUES ('$text', '$text1', '$text2', '$text3', '$text4');";


    mysql_query ($submitquery);

    [/PHP]

    :cool:


  • Registered Users, Registered Users 2 Posts: 9,604 ✭✭✭irishgeo


    thank you.


  • Closed Accounts Posts: 836 ✭✭✭Snowball


    Originally posted by seamus
    Easily done iirc. A database may be neater than a text file.

    The entire page would be written in PHP, including the part with the form, so when the person hits submit, the entire page refreshes itself and can either use the data submitted into the form directly, or you can save it, and use it on the refreshed page.

    To check your own stuff at home, download apache for windows and install the php module.

    www.apache.org
    www.php.net

    It's quite simple and the sites give great walkthroughs :)

    DOnt get me wrong, I know I am not the voice of supreme experiance but php and the like have beem writen to do specific jobs, they can be used for more that that but in esence they do one thing best.

    You might want to look at building a combination of php, sql database and then maybe asp or html or somthing for the output into the webpage.

    Its a off the topof my head idea and I am tired but maybe someone could perfect that????


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by Snowball
    DOnt get me wrong, I know I am not the voice of supreme experiance but php and the like have beem writen to do specific jobs, they can be used for more that that but in esence they do one thing best.

    You might want to look at building a combination of php, sql database and then maybe asp or html or somthing for the output into the webpage.

    Its a off the topof my head idea and I am tired but maybe someone could perfect that????
    What on Earth are you trying to say? PHP and ASP? SQL database (SQL server or MySQL)? ASP or HTML to output into the Web page.

    LOL. You don’t really know what you’re talking about, do you?


  • Closed Accounts Posts: 836 ✭✭✭Snowball


    Originally posted by The Corinthian
    What on Earth are you trying to say? PHP and ASP? SQL database (SQL server or MySQL)? ASP or HTML to output into the Web page.

    LOL. You don’t really know what you’re talking about, do you?

    no, no idea. ffs

    I was talking about the fact that ppl use most coding to do all of what they want and end up with a (eg) website writen all, or nearly all, in VB, or JC and so on. If one wants to do databasing one should use a database program to do it and not use code to run something simular to a batabase just bacause they dont know how or are to lazy.

    The amount of ppl I have seen that learn VB or JC and build a site entirly of them just because they know the code and then wonder why the site sux and takes for ever to load, causes problems they had not seen before or even heard of and even crashes because they are not using the best combination of programs, scrpts and code to make a better site and more efficient site.

    Example, flash. People now a days are building entire flash sites with no code and they take forever to load. I mean it looks nice if you have the bandwith wich most ppl dont.
    Or even HTML. HTML is a great and easy pice of code to learn but it has its purpose in this era of DHTML, XML, VB script, Java, asp, php, HTML, blah, blah, blah.... HTML is quick and easy to load but with the right combo if codes and scripts to back it up (depending on what you want to do) if can be fast loading, usefull, interactive, dynamic, stunning looking and so on.

    I am not saying that I am right but in my experiance using certan codes (and the rest) to preform what they do best normally makes for a top notch site.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Taking from your initial statement...

    I would not recommend mixing scripting technologies such as ASP and PHP, to begin with. They are not interoperable, would require two cuncurrent processes running to parse them and cause maintenance problems in the long run.

    I would agree with the use of databases, but this is dependant upon the project requirements, whether there are going to be complex searches or multiple writes - text files are actually more efficient in some cases. As for the database itself, this depends largely on your overall architecture and its own capabilities.

    Finally, admittedly a pedantic point but, ASP will output to a page, while HTML will generally be the output.


  • Closed Accounts Posts: 1,325 ✭✭✭b3t4


    irishgeo,

    if u wan setup mysql and apache on your home computer. i advice u buy the following book.
    "Php in easy steps"(can remember the authors, sorry).
    It has to be the best book iv ever bought and it cost less than e20. when ur finished with it u can find most of the stuff u want on www.php.net, or www.apache.org (thnk thats the rite one).
    Also its a great php resource when just starting php.

    Also with regard to your actually problem Using php_self as the action for the form will save you alot of time. if i understand your problem correctly
    If u put the code that actually works with the variables being posted from the form at the start of ur php coding ie before the form is output, then have ur code for the table, then code for form It should refresh the contents correctly of the table.

    Hope this helps,
    A.


  • Closed Accounts Posts: 836 ✭✭✭Snowball


    Originally posted by The Corinthian
    I would not recommend mixing scripting technologies such as ASP and PHP, to begin with.

    I was just listing, did not mean to say that one could (or should) use all that on the same site. Just that they all cover a wide range of jobs and overlap in those jobs but some do the same job better than others depending on the specific requirment of the site and what the webmaster wants from the site. I mean MySQL and Apache cover some of the same jobs but depending on what you want its better to use one or the other, that kinda thing....



    [edit]P.S: I agree with b3t4 on "PHP in Easy Steps" (auther is Mike McGrath), I berfly used that book once and it is extreamly good (well from what I read). The first time I saw it I needed something answerd and I only took a few mins to find and the explanation was pretty good.

    Found a link on amazon £9.99 (not bad)
    http://www.amazon.co.uk/exec/obidos/ASIN/1840782072/qid%3D1041946987/202-5211075-9031849[/edit]


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by Snowball
    I was just listing, did not mean to say that one could (or should) use all that on the same site.
    Alright, but that's what it sounded like.
    I mean MySQL and Apache cover some of the same jobs but depending on what you want its better to use one or the other, that kinda thing....
    Out of curiosity, which jobs would both MySQL and Apache cover..?


  • Closed Accounts Posts: 287 ✭✭donaloconnor


    It is possible to use all sorts of technologies on the one site. Achually i think it wud be quite cool and interesting. Multipowered site. hmm interesting....:D


  • Registered Users, Registered Users 2 Posts: 10,339 ✭✭✭✭LoLth


    got rid of the bickering posts.

    You want to discuss, fine, go ahead. You want to flame and snipe, go to the CS board :)

    seriously though, keep it nice.


  • Closed Accounts Posts: 836 ✭✭✭Snowball


    Originally posted by LoLth
    got rid of the bickering posts.

    You want to discuss, fine, go ahead. You want to flame and snipe, go to the CS board :)

    seriously though, keep it nice.
    curios that a mod said that since a mod is doing the sniping


  • Closed Accounts Posts: 287 ✭✭donaloconnor


    Good Job :D


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by Snowball
    curios that a mod said that since a mod is doing the sniping
    Yes, it’s all part of an international Zionist conspiracy...

    You bluffed. You got caught out. Get over it. Let’s all move on.


  • Closed Accounts Posts: 836 ✭✭✭Snowball


    Originally posted by The Corinthian
    You bluffed. You got caught out. Get over it. Let’s all move on.

    Soz, was out all day and just got back a while ago.

    Just read my post and was suposed to be "SunOne" not SQL, was in a hurry and was not paying attention. I was thinking while I posted and I tend to make mistakes when I am not paying to much attention to what I am doing.

    As a mod you should be setting examples not making a fool of your self trying to humiliate ppl you dont know. The status of mod just means that you are on boards more than most and not that you know more.

    As I was saying there are programs (and codes and other sh!t) that cover the same ground but does not mean that they all preform the same in all areas. Some do better than others in different areas.

    Anyways this seems to have left the constructive area and moved on. I hope not but we never know.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by Snowball
    Just read my post and was suposed to be "SunOne" not SQL, was in a hurry and was not paying attention. I was thinking while I posted and I tend to make mistakes when I am not paying to much attention to what I am doing.
    If that was your only typo I'd believe you. btw, which jobs did you say would both MySQL and Apache cover, again?

    Again: You bluffed. You got caught out. Get over it. Let’s all move on.


  • Registered Users, Registered Users 2 Posts: 10,339 ✭✭✭✭LoLth


    ok, nothing more cinstructive being added here.

    Corinthian and snowball. I suggest you take it to PM if you want to continue this. The only thing you are adding to is your post count.


This discussion has been closed.
Advertisement