hosted by liquidweb


Go Back   Web Hosting Talk : Other Forums : Web Hosting Lounge : (PHP) Script Help
Reply

Web Hosting Lounge Forum for general conversation, share interests, have a laugh or discuss topics not related to the above or below forums.
Forum Jump

(PHP) Script Help

Reply Post New Thread In Web Hosting Lounge Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 11-10-2001, 09:19 AM
kmb999 kmb999 is offline
Web Hosting Guru
 
Join Date: Oct 2001
Posts: 291

(PHP) Script Help


I'm trying to create a form using php (I'm just learning php). I wanted to know what I should enter into the script so that when users submit the form their IPs and the current time and date are automatically logged and submited with the form.

Reply With Quote
Sponsored Links
  #2  
Old 11-10-2001, 10:42 AM
Dahlia Dahlia is offline
Junior Guru Wannabe
 
Join Date: Aug 2001
Location: California
Posts: 83
you could try this:
Code:
<?php
$time = date("H:i");
$date = date("m-d-y");
?>

<input type="hidden" name="ipaddress" value="<?php echo $HTTP_SERVER_VARS["REMOTE_ADDR"] ?>">
<input type="hidden" name="date" value="<?php echo $date ?>">
<input type="hidden" name="time" value="<?php echo $time ?>">
you can find time and date values at the php.net site, so you can set those up how you like em'

hope that helps, i'm barely learning php myself..

__________________
HostMagik.Com
Helping Websites Come to Life!

Reply With Quote
  #3  
Old 11-10-2001, 10:44 AM
Randy Randy is offline
Junior Guru Wannabe
 
Join Date: Apr 2001
Posts: 53
I'm not sure where your form is being sent, so here's a basic form to email...

PHP Code:
<?
if ($submit) {
  
$message "Hostname: $REMOTE_HOST\n";
  
$message .= "Date: " date("m/d/y g:ia") . ":\n";
  
$message .= "Name: $name\n";
  
$message .= "Email: $email\n";
  
$message .= "URL: $url\n";
  
$mailto "SERVER_ADMIN"//Change to your email address if needed.
  
mail($mailto,"Form Submission",$message,"From: $name <$email>");
  echo 
"Submission Sent!";
  exit;
}
?>
<form action="<? echo $SCRIPT_NAME?>" method="post">
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
URL: <input type="text" name="url"><br>
<input type="submit" name="submit" value="Submit!">

Reply With Quote
Sponsored Links
  #4  
Old 11-10-2001, 03:37 PM
kmb999 kmb999 is offline
Web Hosting Guru
 
Join Date: Oct 2001
Posts: 291
I did a bit of editing, so this is what I have now...

Code:
if ($submit) {
  $message = "Logged IP $REMOTE_ADDR \n";
  $message .= "Time/Date " . date("g:ia m/d/y") . "\n";
  $message .= "Name $name\n";
  $message .= "Email $email\n";
  $message .= "Domain $domain\n";
  $message .= "Plan $plan\n";
  $message .= "FrontPage $frontpage\n";
  $message .= "Subdomains $subdomains\n";
  $message .= "User $user\n";
  $message .= "Pass $pass\n";
  $message .= "Other $other\n";
  $mailto = "kb@cinqq.net";
  mail($mailto,"Form Output",$message,"From: $name <$email>");
  echo "Submission Sent!";
  exit;
}

echo "<FORM ACTION=\"$SCRIPT_NAME\" METHOD=\"post\">";
echo "<INPUT TYPE=\"text\" NAME=\"name\" SIZE=\"30\">";
echo "<BR>&nbsp;<BR>";
echo "<INPUT TYPE=\"text\" NAME\"email\" SIZE=\"30\">";
echo "<BR>&nbsp;<BR>&nbsp;<BR>";
echo "<INPUT TYPE=\"text\" NAME=\"domain\" SIZE=\"30\">";
echo "<BR>&nbsp;<BR>";
echo "<INPUT TYPE=\"text\" NAME=\"plan\" SIZE=\"30\">";
echo "<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>";
echo "<INPUT TYPE=\"text\" NAME=\"frontpage\" SIZE=\"15\">";
echo "<BR><INPUT TYPE=\"text\" NAME=\"subdomains\" SIZE=\"15\">";
echo "<BR>&nbsp;<BR>&nbsp;<BR>";
echo "<INPUT TYPE=\"text\" NAME=\"user\" SIZE=\"30\">";
echo "<BR><INPUT TYPE=\"text\" NAME=\"pass\" SIZE=\"30\">";
echo "<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>";
echo "<TEXTAREA NAME=\"other\" ROWS=\"6\" COLS=\"40\"></TEXTAREA>";
echo "<BR>&nbsp;<BR>";
echo "<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Submit\">";
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=\"reset\" NAME=\"reset\" VALUE=\"Reset\">";
echo "</FORM>";
The problems...
- The email address part doesn't submit
- I get an error (even though the form submits and I recieve it)
The error says 'Object Expected'. It's not a PHP error, though. It's one of the yellow exclamation points it the bottom left-hand corner.

What can I do to fix these errors?

Thank you!


Last edited by kmb999; 11-10-2001 at 03:57 PM.
Reply With Quote
  #5  
Old 11-10-2001, 04:04 PM
kmb999 kmb999 is offline
Web Hosting Guru
 
Join Date: Oct 2001
Posts: 291
Also, instead of the...

Code:
echo "Submission Sent!";
What should I put there to have it redirect to another page upon submission?

Reply With Quote
  #6  
Old 11-10-2001, 08:18 PM
kmb999 kmb999 is offline
Web Hosting Guru
 
Join Date: Oct 2001
Posts: 291
Please help. I need to finish this asap.

Reply With Quote
  #7  
Old 11-10-2001, 08:50 PM
JTY JTY is online now
Community Guide
 
Join Date: Jun 2000
Location: Washington, USA
Posts: 5,976
Cool

BTW: Why did you echo every line of the form?

__________________
John T. Yocum -- Fluid Hosting
Shared - VPS - Dedicated - Colocation

Reply With Quote
  #8  
Old 11-10-2001, 09:36 PM
greengunboat greengunboat is offline
Junior Guru Wannabe
 
Join Date: Sep 2001
Posts: 60
to get the ip address use this: $ip = getenv ("REMOTE_ADDR");

Reply With Quote
  #9  
Old 11-10-2001, 10:18 PM
kmb999 kmb999 is offline
Web Hosting Guru
 
Join Date: Oct 2001
Posts: 291
Why do I echo every line?
Because I have too much time on my hands.

As far as the ip address part, I tested it and what I currently have works fine.

Reply With Quote
  #10  
Old 11-11-2001, 02:13 AM
delemtri delemtri is offline
Junior Guru Wannabe
 
Join Date: Jul 2001
Posts: 90
Header("Location: redirect_to_this.page");

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Pingdom Talks Top Web Hosting Cities and Countries Web Hosting News 2013-03-27 18:49:54
Whistleblower Site Cryptome Hacked, Infects PCs with Drive-By Exploits Web Hosting News 2012-02-14 14:48:24
Control Panel cPanel Launches New Apache Configuration Script Web Hosting News 2011-12-28 19:41:39
Web Host HostingZoom Adds Softaculous Auto-Installer to Hosting Plans Web Hosting News 2011-08-17 17:52:34
Web Host JaguarPC Adds Auto-Installer Softaculous to Hosting Plans Web Hosting News 2011-07-27 18:55:46


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?