UltimateOreo Posted April 3, 2007 Share Posted April 3, 2007 I want to know if it is possible to create a form simply with PHP, or if I have to use HTML for it, and if I can use php, how do I send the form data to a flatfile on the server? Quote Link to comment Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 PHP is in no way responsible for client side code. PHP outputs strings, most people use it to output strings of html. Having said that, html has no ability to interact with a server, it is strictly a markup language. Explain what it is exactly you want to do. Quote Link to comment Share on other sites More sharing options...
UltimateOreo Posted April 3, 2007 Author Share Posted April 3, 2007 Ok, let me try and explain a little bit better what I am trying to do. I am creating a modification for the vbulletin forum system, and I need a form that will submit text to a page. I can work out the conditionals, but I just need the main code. Any help now? Quote Link to comment Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 This html form will post data to foo.php. <form action="foo.php" method="post"> <input type="text" name="data"> <input type="submit" name="submit"> </form> foo.php <?php if (isset($_POST['submit'])) { echo $_POST['data']; } ?> Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted April 3, 2007 Share Posted April 3, 2007 Also u cn try these within php tags except of html. <?php echo "<form action=\"foo.php\" method=\"post\">"; echo "<input type=\"text\" name=\"data\">"; echo "<input type=\"submit\" name=\"submit\">"; echo "</form>"; ?> This will not require html tags to enclose. Quote Link to comment Share on other sites More sharing options...
UltimateOreo Posted April 3, 2007 Author Share Posted April 3, 2007 Everytime I try to submit the form, I get this- Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@vbulletintests.freeasyhost.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. -------------------------------------------------------------------------------- Apache/1.3.36 Server at www.vbulletintests.freeasyhost.com Port 80 Any help? Quote Link to comment Share on other sites More sharing options...
only one Posted April 3, 2007 Share Posted April 3, 2007 get a different web host :-\ Quote Link to comment Share on other sites More sharing options...
UltimateOreo Posted April 3, 2007 Author Share Posted April 3, 2007 Oh, any good suggestions? My paid host is having severe downtime issues, and I don't exactly want to pay for a new one that i'm not going to use. Quote Link to comment Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 Can you post the exact code you are using? Also, what are the permissions on each file? Quote Link to comment Share on other sites More sharing options...
UltimateOreo Posted April 3, 2007 Author Share Posted April 3, 2007 I CHMOD everything 777 that has to be, and here is all the code that I am using, it is for a modification for the vbulletin forum system, Im am making it so that admins on the site can just fill in a field, and it will be submitted on the page. Heres the codes- The PHP, without any forms/modifications- <?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'biography'); // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array(); // get special data templates from the datastore $specialtemplates = array(); // pre-cache templates used by all actions $globaltemplates = array( 'biography' ); // pre-cache templates used by specific actions $actiontemplates = array(); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); // ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ### eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('biography') . '");'); ?> Heres the HTML that I am using, and that the PHP is fetching- $stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> <!-- no cache headers --> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="Cache-Control" content="no-cache" /> <!-- end no cache headers --> <title><phrase 1="$vboptions[bbtitle]">$vbphrase[x_powered_by_vbulletin]</phrase></title> <style type="text/css"> <!-- .top { border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-top-color: #000000; border-right-color: #000000; border-bottom-color: #000000; border-left-color: #000000; } .all { border: 1px solid #000000; background-color: #FFFFFF; } --> </style> $headinclude </head> <body> $header $navbar <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="$stylevar[cellspacing]" class="all"> <thead> <tr align="center"> <td align="left" valign="top" class="thead"> <div align="left"></div> <div align="left"> <table width="100%" border="0" cellpadding="3" cellspacing="0"> <tr> <td class="tcat">Biographys<td> </tr> <tr> <td><font size=4>The staff here at $vboptions[bbtitle] would like to think of $vboptions[bbtitle] as more of a community, not just a regular bulletin board. To help us achieve this goal, we have decieded to release short autobiographys about ourselves. We believe that this will help all of you to get acquainted with us better. It is always a good thing to know who you are working with.</font></td> </tr> </table> <table width="100%" border="0" cellpadding="3" cellspacing="0"> <tr> <td class="tcat">name of the persons biography<td> </tr> <tr> <td>actual biography goes here</td> </tr> </table> <table width="100%" border="0" cellpadding="3" cellspacing="0"> <tr> <td class="tcat">name of the persons biography<td> </tr> <tr> <td>actual biography goes here</td> </tr> </table> <font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"></font></font></div></td> <if condition="$vboptions[showmoderatorcolumn]"> </if> </tr> </thead> $forumbits <tbody> </tbody> </table> $footer </body> </html> Quote Link to comment Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 Everytime I try to submit the form, I get this- What does the code you just posted have to do with the above mentioned problem? Quote Link to comment Share on other sites More sharing options...
per1os Posted April 3, 2007 Share Posted April 3, 2007 If you do not want to pay for a host simply download apache, php and mysql and setup your own server on your localhost. Quote Link to comment Share on other sites More sharing options...
UltimateOreo Posted April 3, 2007 Author Share Posted April 3, 2007 You asked for the code, I gave you the code. If you were reffering to the code for the form that I was using, it was a copy and paste from your previous answer. Quote Link to comment Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 When I asked for the code, I meant the code related to your actual problem. Sorry but, where exactly is this thread going? Quote Link to comment Share on other sites More sharing options...
UltimateOreo Posted April 3, 2007 Author Share Posted April 3, 2007 Ok, lets make this a little simpler for everyone- I am trying to make a page for my forum, and I want a form that can submit data to that page, or another file, which will be fetched onto that page. Lets start from there. Quote Link to comment Share on other sites More sharing options...
trq Posted April 3, 2007 Share Posted April 3, 2007 I posted an example of how to submit from one page to another. What part don't you understand? Quote Link to comment Share on other sites More sharing options...
UltimateOreo Posted April 4, 2007 Author Share Posted April 4, 2007 I found a new host, which it is working, or is at least a step to working. Heres the current error from your tutorial that I am using- Parse error: syntax error, unexpected $end in /www/110mb.com/v/b/u/l/l/e/t/i/vbulletintests/htdocs/foo.php on line 5 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.