Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Using $_REQUEST in PHP


  • Please log in to reply
4 replies to this topic

#1 JUICYboy

JUICYboy

  • Members
  • 537 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Anaheim, Ca
  • Local time:05:55 PM

Posted 15 May 2010 - 08:58 PM

After 5-6hrs of research and trying :inlove: I ran out of options, and have to post my question..

I am using this php from this link:

http://php.about.com/od/advancedphp/ss/mail_3.htm

It works, when I upload it to the server. :thumbsup: BUT, :flowers: when I want to add (for example) a text field, and after I upload it, it only sends the text area that it came with. But it does not send the textfields that I put in there.

After researching for 5hours I give up for know.. But i think I have to clarify in the code in the .php that I am sending ADDITIONAL info.

That is were I am going wrong.

There is this ($message = $_REQUEST ['message'];) in the .php that sends the default text area, but I need to add more to it. Need I say more?

Please help, my brain just over heated again.. :trumpet:

Edited by JUICYboy, 15 May 2010 - 09:00 PM.


BC AdBot (Login to Remove)

 


#2 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:04:55 PM

Posted 16 May 2010 - 07:12 PM

Its a good idea to post your full code.

Have you given any name to the text-area field you added to your form ? Example : <input type="text" name="message">

Do not use $_REQUEST array. Instead use $_POST or $_GET depending on the method in your form Example : <form method="POST"> then use $_POST['message']

#3 JUICYboy

JUICYboy
  • Topic Starter

  • Members
  • 537 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Anaheim, Ca
  • Local time:05:55 PM

Posted 17 May 2010 - 08:46 AM

I will attach some samples I was working with. This was just an example so I can figure out how to get the additional info:

This is Mockup.html:

<body><form method="post" action="contact.php">
<p>Email:
<input name="email" type="text">
</p>
<p>
</p>
<p>
<label for="FullName">FullName:</label>
<input type="text" name="Full Name" id="Full Name" />
</p>

Message:<br>
<textarea name="message" rows="15" cols="40"></textarea>
<br>
<input type="submit">
</p>
</form>

And this is contact.php:

<?php
$to = "dcomputerdoctor@hotmail.com";
$subject = "This is a Test";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$FullName = $_REQUEST['FullName'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $FullName, $Laptop, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>

Can you give me an example of were I have to use the command you specified.

Well thank you very much for you help, once again. :thumbsup:

Edited by JUICYboy, 17 May 2010 - 12:21 PM.


#4 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:04:55 PM

Posted 17 May 2010 - 03:02 PM

<input type="text" name="Full Name" id="Full Name" />
Should it be "FullName" instead of "Full Name" ? Does it match with your PHP code ?

mail($to, $subject, $message, $FullName, $Laptop, $headers) ;
What is $Laptop ? You are sending $FullName and $Laptop in place of the headers. Check out the PHP help for mail()

If you want to send more information with email, then format it into the message itself. You cannot just pass extra information as parameters to the mail() function. An example would be like :
$message .= $FullName . $Laptop;
See how to work on strings in PHP : http://www.w3schools.com/php/php_string.asp

With the above modification your code can work. If you still cannot send the data, then ask your web host provider. In that case, I suspect the issue would be POST data size configured in the server.

#5 JUICYboy

JUICYboy
  • Topic Starter

  • Members
  • 537 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Anaheim, Ca
  • Local time:05:55 PM

Posted 17 May 2010 - 04:35 PM

I am sorry I am making this more complicated then it should be. :thumbsup:

But I finally made it work, thanks for the help.

Edited by JUICYboy, 17 May 2010 - 06:01 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users