| | |
Simple PHP Question
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Ok here is my code:
this makes output saying:
how can i make it so that they are on different lines, e.g
PHP Syntax (Toggle Plain Text)
<html> <head> <title> PHP Test Page </title> </head> <body> <?php echo date("H:i"); echo gmdate("M d Y"); $counter_file = "count.dat"; if(!($fp = fopen($counter_file, "r"))) die ("Cannot open $counter_file."); $counter = (int) fread($fp, 20); fclose($fp); $counter++; echo "You're visitor No. $counter."; $fp = fopen($counter_file, "w"); fwrite($fp, $counter); fclose($fp); ?> </body> </html>
this makes output saying:
PHP Syntax (Toggle Plain Text)
18:32Mar 12 2007You're visitor No. 5.
how can i make it so that they are on different lines, e.g
PHP Syntax (Toggle Plain Text)
18:32 Mar 12 2007 You're visitor No. 5.
Last edited by jbennet; Mar 12th, 2007 at 3:41 pm.
If i am helpful, please give me reputation points.
ah yes 
now heres a harder question, my site now looks like this
process.php looks like this:
can anyone point me in the right direction of how to get this form to link with a mysql database

now heres a harder question, my site now looks like this
PHP Syntax (Toggle Plain Text)
<html> <head> <title> PHP Test Page </title> </head> <body> <h3><b><u>James Computers Order Form</u></b></h3> <form action="process.php" method="post"> <select name="item"> <option>Computers</option> <option>Monitors</option> <option>PDA's</option> </select> Quantity: <input name="quantity" type="text" /> <input type="submit" /> </form> <?php echo date("H:i"); echo ", "; echo gmdate("M d Y"); $counter_file = "count.dat"; if(!($fp = fopen($counter_file, "r"))) die ("<p><h4>Cannot open $counter_file.</h4></p>"); $counter = (int) fread($fp, 20); fclose($fp); $counter++; echo "<p><h4>You are visitor number $counter</h4></p>"; $fp = fopen($counter_file, "w"); fwrite($fp, $counter); fclose($fp); ?> </body> </html>
process.php looks like this:
PHP Syntax (Toggle Plain Text)
<html> <body> <?php $quantity = $_POST['quantity']; $item = $_POST['item']; echo "You ordered ". $quantity . " " . $item . ".<br />"; echo "Thank you for ordering from James Computers!"; ?> </body> </html>
can anyone point me in the right direction of how to get this form to link with a mysql database
Last edited by jbennet; Mar 12th, 2007 at 4:38 pm.
If i am helpful, please give me reputation points.
Last edited by jbennet; Mar 12th, 2007 at 5:52 pm.
If i am helpful, please give me reputation points.
ok one final problem:
this is wierd. it puts the form on the bottom, button at the top and links in the middle?
i want the form, then the button then the links
screenshot enclosed
can anyone help me
PHP Syntax (Toggle Plain Text)
<html> <head> <title>Test MYSQL PHP Page</title> </head> <body> <h3><b><u>Test MYSQL PHP Page</u></b></h3> <form action="insert_script.php" method="post"> <TABLE BORDER="1"> <tr> <td>First Name: </td> <td><input type="text" name="first"><br></td> </tr> <tr> <td>Last Name:</td> <td><input type="text" name="last"><br></td> </tr> <tr> <td>Phone:</td> <td><input type="text" name="phone"><br></td> </tr> <tr> <td>Mobile:</td> <td><input type="text" name="mobile"><br></td> </tr> <tr> <td>E-mail: </td> <td><input type="text" name="email"><br></td> </tr> <input type="Submit"> </form> <?php echo date("H:i"); echo ", "; echo gmdate("M d Y"); $counter_file = "count.dat"; if(!($fp = fopen($counter_file, "r"))) die ("<p><h4>Cannot open $counter_file.</h4></p>"); $counter = (int) fread($fp, 20); fclose($fp); $counter++; echo "<p><h4>You are visitor number $counter</h4></p>"; $fp = fopen($counter_file, "w"); fwrite($fp, $counter); fclose($fp); ?> <hr> <h3><b><u>Database Tools</u></b></h3> <a href="tbl_create_script.php">(Re)install database table</a> <p> <a href="output_page.php">See output</a> <p> <hr> </body> </html>
this is wierd. it puts the form on the bottom, button at the top and links in the middle?
i want the form, then the button then the links
screenshot enclosed
can anyone help me
Last edited by jbennet; Mar 12th, 2007 at 6:45 pm.
If i am helpful, please give me reputation points.
•
•
•
•
Ok here is my code:
PHP Syntax (Toggle Plain Text)
<html> <head> <title> PHP Test Page </title> </head> <body> <?php echo date("H:i"); echo gmdate("M d Y"); $counter_file = "count.dat"; if(!($fp = fopen($counter_file, "r"))) die ("Cannot open $counter_file."); $counter = (int) fread($fp, 20); fclose($fp); $counter++; echo "You're visitor No. $counter."; $fp = fopen($counter_file, "w"); fwrite($fp, $counter); fclose($fp); ?> </body> </html>
this makes output saying:
PHP Syntax (Toggle Plain Text)
18:32Mar 12 2007You're visitor No. 5.
how can i make it so that they are on different lines, e.g
PHP Syntax (Toggle Plain Text)
18:32 Mar 12 2007 You're visitor No. 5.
Just use a <br> tags within an echo. like this
echo' <br>';
after each output that you want to see
:lol: I am not one of those who wait for things to happen, :p but one of those who make things happen ;)
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: What will a flash xml socket connect to - please help - insanity is near
- Next Thread: session question
| Thread Tools | Search this Thread |
.htaccess advanced ajax apache api array basics beginner binary broken cakephp check checkbox class cms code combobox cookies cron curl database date datepart display download dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert integration ip java javascript job joomla limit link login loop mail menu mlm mod_rewrite multiple mysql oop password paypal pdf php problem query radio random recursion regex remote script search server sessions smarty sms soap source space sql stored syntax system table traffic tutorial unicode update upload url validation validator variable video web xml youtube






