Jump to content

BrandonSi

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by BrandonSi

  1. [!--quoteo(post=386212:date=Jun 20 2006, 07:30 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 20 2006, 07:30 PM) [snapback]386212[/snapback][/div][div class=\'quotemain\'][!--quotec--] always save files with a .php exstention ok example test.php [/quote] God I feel dumb. I was saving it as an .html, since it had .html code in it. [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /] Thanks, it works perfectly now!
  2. [!--quoteo(post=386119:date=Jun 20 2006, 01:52 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 20 2006, 01:52 PM) [snapback]386119[/snapback][/div][div class=\'quotemain\'][!--quotec--] No....php is parsed on the server. Only the outputed html ends up on the client. [/quote] Thanks! Does anyone see any formatting issues with that dropdown box php code? The output was fine when run as a .php but now I think the echo commands are screwed up.. maybe a quotation mark issue? dropdown code [code] <? $dbh=mysql_connect ("localhost", "branthan_et", "enterprise") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("branthan_expensetracker"); $sqlOptions = "SELECT * from categories"; $resultOptions = mysql_query($sqlOptions); echo '<select name="selectName">'; echo '<option value="">--Select--</option>'; while($opt = mysql_fetch_array($resultOptions)) { echo '<option value="'.$opt['categories'].'">'.$opt['categories'].'</option>'; } echo '</select>'; ?>[/code] Output from browser [code] '; echo '--Select--'; while($opt = mysql_fetch_array($resultOptions)) { echo ''.$opt['categories'].''; } echo ''; ?> [/code]
  3. That's what I was thinking, but isn't my db password going to showup in the html source?
  4. [!--quoteo(post=386110:date=Jun 20 2006, 01:22 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Jun 20 2006, 01:22 PM) [snapback]386110[/snapback][/div][div class=\'quotemain\'][!--quotec--] Of course you have to use html. There is no such thing as a form in php. [code] <form action="handle.php" action="POST">   <input type="text" name="amount">amount   <input type="text" name="category">category   <input type="text" name="description">description   <input type="text" name="payment">payment   <input type="text" name="amount">amount   <input type="text" name="date">date </form> [/code] That will post your data to [i]handle.php[/i] which will then be available in the $_POST array. [/quote] Thanks.. That was kind of a dumb question, but I haven't ever worked with php. Now how would I integrate a drop-down box that's populated from my mysql table into that one category field? I've got a php script to do it that executes fine from the browser as .php, is there a way to link a HTML form so that it gets its data from execution of that script?
  5. Do I need to use HTML to get user input from a browser? I'm writing a simple expense tracker and I want the data input to all be on one line, consisting of amount, category, description, payment method and date. I've got the mysql db set up fine, and I put together code snippets to get a drop-down box to show the various categories available.. but when I try to create a simple text box for a user to input amount or description I get lost.. everything I've found on the web seems to use HTML forms.. I just wanna keep my straight .php file. Here's my code for the drop-down box. [code]<? $dbh=mysql_connect ("localhost", "branthan_et", "enterprise") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("branthan_expensetracker"); $sqlOptions = "SELECT * from categories"; $resultOptions = mysql_query($sqlOptions); echo '<select name="selectName">'; echo '<option value="">--Select--</option>'; while($opt = mysql_fetch_array($resultOptions)) { echo '<option value="'.$opt['categories'].'">'.$opt['categories'].'</option>'; } echo '</select>'; ?>[/code] Do I have to echo the HTML? If so could you share an example of how I would do that please? Basically I want to get all the input into variables and create a new record in the table. I can handle the sql code, but the simple stuff is really messing me up!
×
×
  • 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.