GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 19-Jan-2004, 09:26
orbitel orbitel is offline
New Member
 
Join Date: Jan 2004
Posts: 7
orbitel is on a distinguished road

help with form


I am trying to implement a form into my "contact me" page. I have been successful in doing so however I wanted to edit the form a bit to add some stuff to it. I got the form from HotScript.com. Ok, the form is http://www.rons-internet-marketing-tools.com/contact.php . The original fields were (1) full name (2) email address (3) comments. I wanted to edit that and insert some other field like (1) Web site URL (2) Tool Name and two or three other fields. I edited the .php file that accompanies this form (I can send that to you if you would like). Anyway the form works, however the two fields I edited do not (the Web Site URL and the Tools Name). Could someone please help me with this? It looks as though it very easy to do, though I have no experience with this.

Much thanks

Ron
  #2  
Old 19-Jan-2004, 09:31
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello Ron,

Just paste the code in your PHP file (you can X-out any input values you want hidden) and it shouldn't be too difficult to identify the problem.
  #3  
Old 19-Jan-2004, 09:40
orbitel orbitel is offline
New Member
 
Join Date: Jan 2004
Posts: 7
orbitel is on a distinguished road
Ok but it's long


PHP Code:

<?php


if ($HTTP_SERVER_VARS['REQUEST_METHOD'] != "POST"){exit;}

$name = stripslashes($HTTP_POST_VARS['name']);
$weburl = stripslashes($HTTP_POST_VARS['weburl']);
$comments = stripslashes($HTTP_POST_VARS['comments']);
$toolname = stripslashes($HTTP_POST_VARS['toolname']);
$formemail = $HTTP_POST_VARS['formemail'];

$subject = "Contact Ron";
$message = "From: $name\nEmail address: $formemail\n\n$comments\n\n------------------------------------------------------------------\nThanks contacing me.  I will try to get back to you within 48 hours.\n------------------------------------------------------------------";
$headers = "From: " . $formemail . "\n" . "Return-Path: " . $formemail . "\n" . "Reply-To: " . $formemail . "\n";

mail($email,$subject,$message,$headers);

?>

Last edited by JdS : 21-Jan-2004 at 16:31. Reason: removed unnecessary code to keep the post short.
  #4  
Old 19-Jan-2004, 10:01
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Please insert any PHP code inside the [ PHP ] tags... I get a migraine looking at text in black

On topic:

Look for the code lines that look like this:

PHP Code:

<?php
// ...

$message = "From: $name\nEmail address: $formemail\n\n$comments\n\n------------------------------------------------------------------\nThanks contacing me.  I will try to get back to you within 48 hours.\n------------------------------------------------------------------";

// ...
?>


Replace that with something like this:

PHP Code:

<?php
// ....

$message  =  "From: $name\n".
             "Email address: $formemail\n".
             // inserting the website URL...
             "Website: $weburl\n".
             // inserting the tool name...
             "Tool Name: $toolname\n\n".
             "$comments\n\n------------------------------------------------------------------\nThanks contacing me.  I will try to get back to you within 48 hours.\n------------------------------------------------------------------";

// ....
?>


If you want me to explain, just ask...
  #5  
Old 19-Jan-2004, 10:12
orbitel orbitel is offline
New Member
 
Join Date: Jan 2004
Posts: 7
orbitel is on a distinguished road
No I got that part.

Any suggestions on adding extra fields to it so visitors can input additional information?
  #6  
Old 19-Jan-2004, 10:19
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Additional information? Explain what you want exactly and I will try to help you otherwise I am not good at guessing.
  #7  
Old 19-Jan-2004, 12:01
orbitel orbitel is offline
New Member
 
Join Date: Jan 2004
Posts: 7
orbitel is on a distinguished road
I think maybe there was a miscommunication on my part in my first post. If you notice the fields http://www.rons-internet-marketing-tools.com/contact.php I'd currently have three of them. I would like to add additional fields (i.e. 'Web site URL', 'Tool Name', and two or three other fields). I have attemped to do this however when filling in the fields (the new ones) that information doesn't come through in the email.

p.s I had the Web Site URL and Tool Name field in before, but I took them out because I couldn't get them to work.
  #8  
Old 20-Jan-2004, 10:19
orbitel orbitel is offline
New Member
 
Join Date: Jan 2004
Posts: 7
orbitel is on a distinguished road
Thanks jds!

Only after reviewing your last post I understood what you were talking about. I got it working now.

agian thanks!!! :-)
  #9  
Old 20-Jan-2004, 13:33
orbitel orbitel is offline
New Member
 
Join Date: Jan 2004
Posts: 7
orbitel is on a distinguished road
Is is possible to insert a radio button in the form? Also how do you make the fields "required". Does anyone know of "how to" site on forms?
  #10  
Old 20-Jan-2004, 16:55
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
re: radio button in a form...

You can insert a radio button (in a form) easily like this:

HTML Code:
<form name="form1" id="form1" method="post" action="feedback.php"> <p> <input type="radio" name="callme" value="yes" /> Call me<br /> <input type="radio" name="callme" value="no" /> Don't call me </p> </form>

re: Also how do you make the fields "required"

In the simplest example, you can do something like this... note my comments in the code..

PHP Code:

// let's say the text input named "car" in your form has to be filled in.
// once the user has submitted the form, your script will have the following variable set
$car = $_POST['car']; // OR, if you use an older PHP version, $HTTP_POST_VARS['car']

// depending on your MAGIC_QUOTES_GPC settings, you would normally stripslashes
$car = stripslashes( $car ); // if you plan to display this value in a web page or send it in an email

// Now you must ensure this data is not just spaces or even empty

// remove any whitespace
$car = trim( $car );
// what's left?  if PHP says $car is empty, we tell the user they made a boo boo
if( empty($car) )
{
  die( "Please fill in the required data or else!" );
}

// if we reached here, everything "required" was filled in...
?> 


re: Does anyone know of "how to" site on forms?
You're ALREADY here!
 
 

Recent GIDBlogToyota - 2008 November Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why doesnt my form work correctly? rhino1616 Web Design Forum 2 06-Nov-2003 18:21
simple form from generated page zuzupus Web Design Forum 0 17-Sep-2003 10:27
form in a table cell blelisa Web Design Forum 1 19-Aug-2003 10:14
validate form skyloon MySQL / PHP Forum 3 15-Jul-2003 10:04
How to encrypt mail sent by your feedback form? JdS Web Hosting Forum 4 30-Aug-2002 08:51

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:14.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.