PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
IBM developerWorks
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old June 28th, 2002, 11:03 AM
harsha harsha is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: india
Posts: 17 harsha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to harsha
php discussion online

<html>
<body>
<?php
/*
the if statement verifies HTTP_POST_VARS variable
if this is true then the followig code is executed
*/
if($HTTP_POST_VARS)
{
/*he htmlspecialchars disable html output
say the symbol ">" is converted into >
*/

$new_name=htmlspecialchars($name);
$new_message=nl2br($message);
echo "<br>".$new_name."<br>".$subject."<br>".$new_message;
}
?>
<form method="post" action="<?=$PHP_SELF?>">
<input type="text" name="name">
<input type="text" name="subject">
<textarea name="message" cols="30" row="30"></textarea>
<input type="submit" value="mail">
</form>
</body>
</html>

plz comment and suggest this small program

Reply With Quote
  #2  
Old June 28th, 2002, 04:07 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: php discussion online

couple of things...I would use $_POST rather than $HTTP_POST_VARS. Also, I would do an if(isset($_POST)). This is a small program, but preserving memory anywhere you can is a good thing..I would do this:

echo "<br>".(htmlspecialchars($name))."<br>".$subject."<br>".(nl2br($message));

and get rid of the:

$new_name=htmlspecialchars($name);
$new_message=nl2br($message);

unless you plan on using $new_name and $new_message again in the script. As it is, you are defingin two new variables (and using memory), when you don't really need to.

Reply With Quote
  #3  
Old June 29th, 2002, 10:43 AM
harsha harsha is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: india
Posts: 17 harsha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to harsha
RE: php discussion online

thanx mr ..
sorry i don't know your name you taught me so much i din't had the sense of memory management and i learnt it form you and thatnx once again
can you plz tell me more detalis about $_POST
$HTTP_POST_VARS

Reply With Quote
  #4  
Old June 29th, 2002, 08:59 PM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: php discussion online


Reply With Quote
  #5  
Old June 30th, 2002, 07:48 AM
harsha harsha is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: india
Posts: 17 harsha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to harsha
RE: php discussion online

hello
mr.EvilivE
i need one more help from you.
i want to create previous and next links to the data accessed form a text file and i want two message to be displayed per page how can i do that. Is it possible if i use file()
function and store each line in an array and access two array elements at a time

Reply With Quote
  #6  
Old June 30th, 2002, 10:35 AM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: php discussion online

array_slice

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > php discussion online


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway