•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,749 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,619 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3190 | Replies: 18
![]() |
•
•
Join Date: Jan 2005
Location: Sheffield, UK
Posts: 294
Reputation:
Rep Power: 4
Solved Threads: 6
I learnt php + mysql from Internet sites. One I most recommended is http://www.php-mysql-tutorial.com/index.php. It would be easier if you know VB.
For hosting, you can get a few free for practice purposes. Do google search.
For hosting, you can get a few free for practice purposes. Do google search.
Ecommerce-Web-Store.com Building Your e-Business.
•
•
Join Date: May 2005
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
Hey all,
Ok here is an new update on my behalf. I have printed all 1801 pages of the php.net manual.
I have study this manual inside and out and have read all pages and did all exmples they had posted in the manual. The I went to the book store and bought 10 different php books and have read about 3 of them already.
You would think after reading the php.net manual and at least 3 books I would know how to write php, but I am still not understanding everything I have read.
I am trying to make a contact form, a Place Ad form, and a edit ad form,
the contact use form is I am sure all easy to you guys. But for some reason I do not know where to begin.
the Place ad form, I want people to be able to post ads about there cars they have for sell, and well with the Edit Ad I am sure you know what that means as well.
One other thing I am trying to make a Upload script as well for the same site, that will upload and update the clients pictures of there cars or to add new pictures.
Can any one here give me a hand on how this would all be done.
Thank you all for the help in advanced.
MichaelK5 -
:cheesy:
Ok here is an new update on my behalf. I have printed all 1801 pages of the php.net manual.
I have study this manual inside and out and have read all pages and did all exmples they had posted in the manual. The I went to the book store and bought 10 different php books and have read about 3 of them already.
You would think after reading the php.net manual and at least 3 books I would know how to write php, but I am still not understanding everything I have read.
I am trying to make a contact form, a Place Ad form, and a edit ad form,
the contact use form is I am sure all easy to you guys. But for some reason I do not know where to begin.
the Place ad form, I want people to be able to post ads about there cars they have for sell, and well with the Edit Ad I am sure you know what that means as well.
One other thing I am trying to make a Upload script as well for the same site, that will upload and update the clients pictures of there cars or to add new pictures.
Can any one here give me a hand on how this would all be done.
Thank you all for the help in advanced.
MichaelK5 -
:cheesy: •
•
Join Date: Jan 2005
Location: Sheffield, UK
Posts: 294
Reputation:
Rep Power: 4
Solved Threads: 6
I don't think reading is enough and effective way to learn something like php. hand on practical experience is more important. I learnt php not even bought a book or print out the manual. I suggest you search for script (from Internet) that you want to program with and modify the code to suit your need. I only refer the manual when I need function that I not totally understand, or cannot remember, such as date's variables.
Here's email contact script:
[PHP]<?php
if(strlen($_POST["textarea"]) > 10 && isset($_POST["email"])) {
$mssg = str_replace(Chr(13), "<br>", $_POST["textarea"]);
$mssg = stripslashes($mssg);
$to = "yourself@yourdomain.com";
$subject = $_POST["subject"];
$message = "<i>Message from ". $_POST["client"] .":</i>\r\n<br><br>";
$message .= $mssg;
// and now mail it and print confirmation
mail($to, $subject, $message, $headers);
echo "<h1>Email Sent! </h1>";
}
?>
<form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table width="100%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td width="25%">Your Name:</td>
<td width="75%"><input type="text" name="client" size="30"></td>
</tr>
<tr>
<td>Your Email:</td>
<td><input type="text" name="email" size="30"></td>
</tr>
<tr>
<td>Subject:</td>
<td><input type="text" name="subject" size="30"></td>
</tr>
<tr valign="top">
<td height="25">Message:</td>
<td><textarea name="textarea" rows="10" cols="65"></textarea></td>
</tr>
<tr valign="bottom">
<td></td>
<td><input type="submit" name="Submit" value=" Send Email "></td>
</tr>
</table>
</form>
[/PHP]
Here's email contact script:
[PHP]<?php
if(strlen($_POST["textarea"]) > 10 && isset($_POST["email"])) {
$mssg = str_replace(Chr(13), "<br>", $_POST["textarea"]);
$mssg = stripslashes($mssg);
$to = "yourself@yourdomain.com";
$subject = $_POST["subject"];
$message = "<i>Message from ". $_POST["client"] .":</i>\r\n<br><br>";
$message .= $mssg;
// and now mail it and print confirmation
mail($to, $subject, $message, $headers);
echo "<h1>Email Sent! </h1>";
}
?>
<form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table width="100%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td width="25%">Your Name:</td>
<td width="75%"><input type="text" name="client" size="30"></td>
</tr>
<tr>
<td>Your Email:</td>
<td><input type="text" name="email" size="30"></td>
</tr>
<tr>
<td>Subject:</td>
<td><input type="text" name="subject" size="30"></td>
</tr>
<tr valign="top">
<td height="25">Message:</td>
<td><textarea name="textarea" rows="10" cols="65"></textarea></td>
</tr>
<tr valign="bottom">
<td></td>
<td><input type="submit" name="Submit" value=" Send Email "></td>
</tr>
</table>
</form>
[/PHP]
Ecommerce-Web-Store.com Building Your e-Business.
•
•
Join Date: Jan 2005
Location: Sheffield, UK
Posts: 294
Reputation:
Rep Power: 4
Solved Threads: 6
Here is the upload script:
[PHP]<form method="POST" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%">File 1:</td>
<td width="80%"><input type="file" name="file1" size="35"> </td>
</tr>
<tr>
<td>File 2: </td>
<td><input type="file" name="file2" size="35"> </td>
</tr>
<!-- can add more input here -->
<tr>
<td> </td>
<td height="40"><div align="center">
<input type="submit" name="submit" value=" Upload ">
</div></td>
</tr>
</table>
</form>
<?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES.
if($_FILES["file1"]["size"] > 0) {
echo "<h4>Upload Result</h4>";
for ($i=1; $i<=5; $i++)
{
$file = $_FILES["file".$i];
echo "File ".$i.": ";
if($file["size"] > 0) {
$fileName = basename($file["name"]);
$ext = substr($fileName, -3, 3);
// filter file you allow to upload
$accept = array('pdf','doc','xls','ppt','txt','zip');
// filter filesize
if ($file["size"] > 500000) {
echo "Filesize over 500 KB limit.<br>\n";
}
elseif(!in_array($ext, $accept)) {
echo "Invalid file format. <br>\n";
}
else {
// set folder path to which image uploaded
$uploaddir = "../shop/".$shop_id."/"; // name of directory
//copy the file to some permanent location
if (move_uploaded_file($file["tmp_name"], $uploaddir . $file["name"])) {
echo $file["name"]." uploaded.<br>\n";
} else {
echo "Error found. Please try again. <br>\n";
}
}
} else {
echo "File not found.<br>\n";
}
}
}
?>[/PHP]
[PHP]<form method="POST" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%">File 1:</td>
<td width="80%"><input type="file" name="file1" size="35"> </td>
</tr>
<tr>
<td>File 2: </td>
<td><input type="file" name="file2" size="35"> </td>
</tr>
<!-- can add more input here -->
<tr>
<td> </td>
<td height="40"><div align="center">
<input type="submit" name="submit" value=" Upload ">
</div></td>
</tr>
</table>
</form>
<?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES.
if($_FILES["file1"]["size"] > 0) {
echo "<h4>Upload Result</h4>";
for ($i=1; $i<=5; $i++)
{
$file = $_FILES["file".$i];
echo "File ".$i.": ";
if($file["size"] > 0) {
$fileName = basename($file["name"]);
$ext = substr($fileName, -3, 3);
// filter file you allow to upload
$accept = array('pdf','doc','xls','ppt','txt','zip');
// filter filesize
if ($file["size"] > 500000) {
echo "Filesize over 500 KB limit.<br>\n";
}
elseif(!in_array($ext, $accept)) {
echo "Invalid file format. <br>\n";
}
else {
// set folder path to which image uploaded
$uploaddir = "../shop/".$shop_id."/"; // name of directory
//copy the file to some permanent location
if (move_uploaded_file($file["tmp_name"], $uploaddir . $file["name"])) {
echo $file["name"]." uploaded.<br>\n";
} else {
echo "Error found. Please try again. <br>\n";
}
}
} else {
echo "File not found.<br>\n";
}
}
}
?>[/PHP]
Ecommerce-Web-Store.com Building Your e-Business.
•
•
Join Date: May 2005
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
Zippee,
For some reason the e-mail script is not working it never sends the test mail to me.
Upload script is not working either, its giving me the following.....
File 1:
File 2:
Upload Result
File 1: Invalid file format.
File 2: File not found.
File 3: File not found.
File 4: File not found.
File 5: File not found.
For some reason the e-mail script is not working it never sends the test mail to me.
Upload script is not working either, its giving me the following.....
File 1:
File 2:
Upload Result
File 1: Invalid file format.
File 2: File not found.
File 3: File not found.
File 4: File not found.
File 5: File not found.
•
•
Join Date: Jan 2005
Location: Sheffield, UK
Posts: 294
Reputation:
Rep Power: 4
Solved Threads: 6
1. Make sure your hosting enable smtp, so that email can be sent out.
2. Make sure you upload the correct file extension, as listed.
2. Make sure you upload the correct file extension, as listed.
Ecommerce-Web-Store.com Building Your e-Business.
•
•
Join Date: May 2005
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
Well Ok I have gotten the Contact us form to work.
But I still can not upload anything using the script Zeppe gave me even with the changes within our pms.
I am wondering if anyone else can help fix this problem.
Thank you.
P.S. I have started a New community forum and could use some feedback and php helpers.. If anyone is could help please let me know..
But I still can not upload anything using the script Zeppe gave me even with the changes within our pms.
I am wondering if anyone else can help fix this problem.
Thank you.
P.S. I have started a New community forum and could use some feedback and php helpers.. If anyone is could help please let me know..
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
adult advertising blog browser browsing code community daniweb data design development devices domains firefox google html intel internet java legal linux marketing merger microsoft mobile applications mozilla msn multimedia news php privacy report research rss search security sex software sun technology video w3c web web development wiki wikipedia xml yahoo youtube
- New to Dani Web (Community Introductions)
- What does Dani Web mean to you? (Geeks' Lounge)
- Dani Web 404 Error File Not Found (DaniWeb Community Feedback)
- Dear Dani Web Members. (Web Hosting Deals)
- Hello Dani Web members (Internet Marketing Job Offers)
Other Threads in the PHP Forum
- Previous Thread: include(); problem
- Next Thread: Help With Contact Us Form!


Linear Mode