Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 05-04-2011, 08:59 AM
baby.hack baby.hack is offline
Junior Member
 
Join Date: 05-04-11
Posts: 4
iTrader: 0 / 0%
Help Figuring Out Contact Form

Hi,
I'm new to these forums. I have some basic webdesign and programming knowledge, but I'm still not really familiar with php or js. I'm a bit of a newbie.

I friend has asked me to help with a site they run, and the contact form they are using needs to have the "to" email changed.

Perhaps someone here might be able to point me in the right direction?

The page is http://www.parkdaleliberty.com/show_info.php?page_id=8

The form is in a .php file, the contents of which are printed in the page source from that file.

So far I'm not sure what I should be looking for.

I'm familiar with forms of the <form method="POST" action="somefile.php"> variety, but this seems different. What happens when the submit button is pressed? Where should I be looking to find the code that processes and sends the form (ie: if(isset($_POST['submit'])) { .....} )

I feel like this should be obvious, so forgive me if it is.
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 05-04-2011, 10:05 AM
nemrod's Avatar
nemrod nemrod is offline
v7n Mentor
 
Join Date: 12-21-10
Location: Sweden
Posts: 463
iTrader: 0 / 0%
First of all, welcome to the forums! Hope you have a good stay.

Now, as for your problem, it's impossible to say without seeing the PHP code. The form should send to the same page since there is no action attribute, so take a look at the source code of it.
 
Reply With Quote
  #3  
Old 05-04-2011, 03:38 PM
diondevelopment diondevelopment is offline
Junior Member
 
Join Date: 05-04-11
Posts: 14
iTrader: 0 / 0%
When the submit button is pressed, it sends POST variables server-side so that the values can then be used through whatever programming language they are using.

Through this code they are sending the email, using the POST variables.

Last edited by diondevelopment; 05-04-2011 at 03:45 PM.
 
Reply With Quote
  #4  
Old 05-04-2011, 09:57 PM
bwclapp bwclapp is offline
Member
 
Join Date: 04-30-11
Posts: 34
iTrader: 0 / 0%
your form action is set to somefile.php (action="somefile.php")

the somefile.php will have to get the variables somehow (done by using $_POST[])

for example.. your somefile.php will contain at the top

Code:
$firstname = $_POST['first_name']; $lastname = $_POST['last_name']; $age = $_POST['age'];
then you would be able to do anything you wanted with them on the somefile.php script, whether it be emailing the form or posting them on the page.

Code:
echo $firstname; // Displays the first name from the form that was submitted.
Hope this helps...
 
Reply With Quote
  #5  
Old 05-04-2011, 10:57 PM
nemrod's Avatar
nemrod nemrod is offline
v7n Mentor
 
Join Date: 12-21-10
Location: Sweden
Posts: 463
iTrader: 0 / 0%
Quote:
Originally Posted by bwclapp View Post
your form action is set to somefile.php (action="somefile.php")

the somefile.php will have to get the variables somehow (done by using $_POST[])

for example.. your somefile.php will contain at the top

Code:
$firstname = $_POST['first_name']; $lastname = $_POST['last_name']; $age = $_POST['age'];
then you would be able to do anything you wanted with them on the somefile.php script, whether it be emailing the form or posting them on the page.

Code:
echo $firstname; // Displays the first name from the form that was submitted.
Hope this helps...
Indeed, but it would help even more if you had taken a look at the page first. There is no action attribute on the form tag, for example, but as I said that means it should post to itself.
 
Reply With Quote
  #6  
Old 05-05-2011, 12:05 AM
bwclapp bwclapp is offline
Member
 
Join Date: 04-30-11
Posts: 34
iTrader: 0 / 0%
If you are making it submit to itself you may have to put the action as show_info.php although I'm not sure how this would work with it having a GET variable (?page_id= in the URL. I believe you can only use either GET or POST, but not both. I'm pretty sure since you are using GET for the page id, you will have to pass the information along using the GET method for the users information as well.

then your url would look something like ?page_id=8&name=$name&email=$email&phone=$phone$.. .etc so forth and so on.

You would then, instead of using POST at the top of that file, use GET to get the form data from the browsers url. GET forms are a little bit trickier than POST forms... I'm tired and loopy right now, but google should help you out from here.

Another alternative is to make the form POST to a separate .php file that opens up in a fixed size window with no scrollbars with text and maybe an image saying something like "Your information has been sent. We will be in touch soon" (you get the point)

Although, to answer the question directly, I don't think you can use POST on this page since it is already using GET for the page_id.
 
Reply With Quote
  #7  
Old 05-05-2011, 12:16 AM
nemrod's Avatar
nemrod nemrod is offline
v7n Mentor
 
Join Date: 12-21-10
Location: Sweden
Posts: 463
iTrader: 0 / 0%
Quote:
Originally Posted by bwclapp View Post
If you are making it submit to itself you may have to put the action as show_info.php although I'm not sure how this would work with it having a GET variable (?page_id= in the URL. I believe you can only use either GET or POST, but not both. I'm pretty sure since you are using GET for the page id, you will have to pass the information along using the GET method for the users information as well.

then your url would look something like ?page_id=8&name=$name&email=$email&phone=$phone$.. .etc so forth and so on.

You would then, instead of using POST at the top of that file, use GET to get the form data from the browsers url. GET forms are a little bit trickier than POST forms... I'm tired and loopy right now, but google should help you out from here.

Another alternative is to make the form POST to a separate .php file that opens up in a fixed size window with no scrollbars with text and maybe an image saying something like "Your information has been sent. We will be in touch soon" (you get the point)

Although, to answer the question directly, I don't think you can use POST on this page since it is already using GET for the page_id.
You can send POST-data to a page with querystrings.
 
Reply With Quote
  #8  
Old 05-06-2011, 06:25 AM
baby.hack baby.hack is offline
Junior Member
 
Join Date: 05-04-11
Posts: 4
iTrader: 0 / 0%
You guys are awesome. Why is that?
I hadn't even thought to look at show_info for the contact form processing. I was looking at the page with id 8, at the contactform.php file with the form in it, at the php file that is one of the includes in contactform.php. But of course, if the form is posting to itself, and the page is show_info.php... well, *facepalm*.

Now I have another issue. Apparently the reason the address needed to be changed is because the form was generating spam. I figured i would post that a separate issue: http://www.v7n.com/forums/coding-for...ml#post1656053
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
contact form silver163 Coding Forum 4 10-08-2009 12:00 PM
I need help with contact form iorgyzu88 Coding Forum 7 09-17-2009 10:37 AM
Contact form please help to create a contact form jennypretty Coding Forum 2 07-03-2008 07:49 AM
Need help with contact form gordon Coding Forum 9 05-13-2008 04:44 PM
Help me with a better contact form andreeam Coding Forum 4 11-18-2006 01:56 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 03:50 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC