PHP {Programs}

Techno Child

web{designer}
Joined
10 Oct 2004
Messages
871
I need help coding a few php programs... I am a visual person to where I have to have examples to understand what i'm doing :squareeye

First, I am trying to create a php script that will process html forms such as this,
Code:
<form action="process.php" method="post">
<input type=text name=textbox>
</form>
,to post whatever is submitted in the textbox onto the same php page...

{this is where i thought i could use agneta's donation recording script - mainframeguy so maybe the best way to go around this is to start with what you had?}

i just started learning php yesterday so this is all new to me :)


Thanx
 
attached the phps... lemme know if any probs
 

Attachments

  • fortechno.zip
    9.2 KB · Views: 57
hmm.. is there a reason why apache would make these files forbidden? i cannot access them at all :( ... let me try to reunzip them


btw.. thanks for uploading them :D
 
is there any way i can check to see if i have mysql configured properly? the installer just left me hanging with no further documents or actions to take
 
mebbe time for a new thread again! Xistence is, I think, something of a MySQL guru... no doubt he'll tell me if I am wrong....
 
does apache have read access to the the files and the directory they are in?

if php cant connect to the database it should complain about it.

try this though
Code:
<?php
error_reporting(E_ALL);
mysql_connect('host', 'user', 'password');
mysql_select_db('database name');

$result = mysql_query("SELECT * FROM {$table_name}");
while ($row = mysql_fetch_array($result)) {
    echo "Printing Row data\n";
    print_r($row);
    echo "Finished Printing Row data\n";
}
?>
 
thanks guys.. i got it worked out last night... i setup everything in php using flat files so i don't really need mysql for a while... (going on 38 hrs. :dead: ) This will also help keep this thread on focus of PHP :)


My next issue is login. I want to have certain parts of my site only availible to those that i give a key to (such as file upload page for people to send me files) i know htaccess is probably the best way to do this in apache, however I would like to add it to the sidemenu and make it match the site.

On my last site i had the form for this all setup, however it was very unsecure (using javascript - and the password was actually IN the code!?!)

Is there a php script that retrieves data from a secure field
Code:
<form action="passcheck.php" method="post">
<input type=text name=username><br>
<input type=password name=password>
</form>

such as the one above?
 
just use something like

Code:
<?
$password = $_POST['password'];
echo $password;
?>
 
how would i put mulitple passwords on that? would i just repeat the whole code minus the <?/?>'s? and which password would be replaced with the pages password? ( i really am a php newb as i just started learning it this week :()

also, it would have to have different redirection pages... is there a way to replace the echo with a page redir?
 
ok.... so far i have everything worked out except this.... i can't get this to send an email... i know my server is setup for email because a code worked before i just forgot how i did it...
maybe this is just messed up---
Code:
<?php
if(isset($_POST['submit'])) {
$to = $_POST['email'];
$subject = "New Account";
$email_field = $_POST['email'];
$message = "here is the contents of the message";
 
$body = "$message";
 
echo "";
mail($to, $subject, $body);
} else {
echo "An error has occured.  Contact the server admin.";
}
?>
 
please help someone... this one i have no idea about what's wrong... it doesn't echo "an error has occured~~~" it just loads the rest of the page like normal and it doesn't send out the email...
 
you need to put an "if" in
PHP:
<?php
if(isset($_POST['submit'])) {
$to = $_POST['email'];
$subject = "New Account";
$email_field = $_POST['email'];
$message = "here is the contents of the message";
 
$body = "$message";
 
echo "";
  if(!mail($to, $subject, $body))
  {
  echo "An error has occured.  Contact the server admin.";
  }
}
?>
 
it still doesn't work... however now it does give me the error message

what else could it be? if you need more info about the pages i could upload them for you
 
try adding a "from" field, i know some won't send without it

PHP:
$to = $_POST['email'];
$subject = "New Account";
$message = 'TESTING';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
 
if(!mail($to, $subject, $message, $headers))
{
echo "An error has occured. Contact the server admin.";
}
if the "mail" function is still not working its probably something todo with you host, perhaps they've broken it recently. The script is working
 
still no go... it doesn't send it to me.... i'm going to check and make sure everythings ok with php's config... will let u know



yep... it's something wrong with the server.... sorry for bugging you guys...i'm going to have fun troubleshooting-the joys of having your own dedicated server :dead:
 
ok.... found the problem... it looks like i caused it from the beginning (don't know how it worked even then?!) i was lazy and i just cp/pasted my php.ini file from my ibook onto the g3 since the g3 was a fresh instal and my book was already configured....


theproblem:= ibook-php5.1; g3-php4.3.4 :dead: now i have to reinstall php on the crapmacg3 so it will work... i hope that was the problem




EDIT: ok.... i got a php.ini from php4 however it still won't send it... i know the code's good because it works on my ibook, it just won't send on the other comp. i'm going to re-research how to setup php.ini to send mail... it has something to do with unix's sendmail function i think.... idk
 
Last edited:
let us know when you get it figured. :)
 
Your Crapmac as you call it is not running a mail server and thus can't send you any email.
 
y? it has a sendmail file in /sbin ... what do I need to do? I thought that was installed with osx - my Ibook sends out emails when I have webserver enabled.

Is there something extra I need to install for 10.2?
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back