I am learning web design on my own and have figured most of it out and think I have done okay . However, I have a registration page I just cannot make work. I cannot find the correct string for form action, the server information or the database information. I cannot even figure out what it is I am looking for - in other words what would the string look like- I tried asking my hosting company because if I put in their server name the database comes back and says "Access Denied" but I get absolutely no answers from them.
Is there anyone out there who can help me?? Please.
Figment
:eek: :eek: :eek: :eek:
Need Help Submit Button
<form id='any name' name='any name' method='post' action='url that will process'>
That is the form tag. You should include a </form> tag to close it out as well.
Is that what you're looking for, or are you looking to figure out how to write the registration info to the database?
HOnestly, I am not 100% sure. I have been working on getting this stupid submit button to work for 3 days. I will try the information you gave me. The problem seems to be that I am not sure if I put my http in and how and how I tell it to send to email. Also my system will not accept the srver and database information I am entering. As I said I am new to this.
Thank you for helping if you have more info I will gladly accept all suggestions.
Figment
Figment,
You may want to post your code so we can take a look. My general practice it to be sure I have the form posting data back to the page (via the $_POST variable) long before I try to e-mail or Insert it into the database.
Something like this:
<html>
<head>
<title></title>
</head>
<body>
// action=="<?php echo $_SERVER['PHP_SELF']; ?> " tell the page to submit
// itself back to the same page.
<form id="form" name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ">
<div><label for='field1'>Field 1:</label>
<input type='text' id='field1' name='field1' />
</div>
<div><label for='field1'>Field 2:</label>
<input type='text' id='field2' name='field2' />
</div>
<input type='submit' name='btnSubmit' id='btnSubmit' value='Submit Data' />
</form>
</body>
</html>
// this section will display the form results
<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
?>
That is as generic as it gets for forms... This should display a form with 2 fields and submit it back to the page you save it as (remember to save with extension .php). When it redisplays the form, an array of the form variables will appear below the form.
If I'm understanding you correctly you are trying to build a form that submits the data to an e-mail address. What you need to understand is that an HTML form will do nothing without an action and method associated with it.
A METHOD is the way in which the form will pass the information. GET will pass the information as variables that you define in the URL to the script that handles the action part of the <form> element. POST will post the information to the browser, keeping the information submitted out of the URL and hidden from the user. Keep in mind that whatever method you use to send the information is the method you need to use to retrieve on your script that handles the action.
The ACTION is what handles all the magic. For example, I just wrote a small script that adds a user and loosely functions like this:
addUser.html
<html>
<head>
<title>Add User</title>
</head>
<body>
<form name="addUser" method="post" action="addUser.php">
Name:<br>
<input type="text" name="userName" maxlength="25"><br>
<input type="submit" name="submit" value="Add!">
</form>
</body>
</html>
Now on my ACTION script
addUser.php
<?
//Get the username
$user = $_POST['userName'];
//SQL code to follow that will add the user to the db.
?>
I've left out the SQL code because I don't want to overwhelm you. What I do want to do, however, is make sure you understand that just because you put a button on a form doesn't mean it's going to do anything. You have to write an ACTION script that does what you want.
There are tons of tutorials for sending to e-mail and precompiled programs (like phpMailer) that are great to use for implementation and education.
I hope this guides you in the right direction!
If you can provide the code you are working with. Furthermore what database are you currently using and are you familiar with the workings of the database and how to initually open and close them?
General reason for it returning access denied is the fact that you have not provided the script with the correct details to open the database before entering new information.
Here is the code informtion you all asked for- Sorry It tool so long to get it but I was online with the hosting company most of the day going nuts!!!!
This is the action form information that cgi told me to put in (which is not working by the way):
<form action="form action= "http://www.pilgriment.com/ContactForm.php/cgi-bin/cgiemail" method="post" name="ContactForm" id="ContactForm">
Here is the submit button information
</a><input type="submit" name="SubmitName" value="Submit" /></span></td>
PS: My document was changed to a .PHP document at the hosting company's request -Does this make a difference?
Here is some other information they gave me on the location of the files for cgiemail.
/home/c41530/public_html/cgi-bin
The database I quess would be my domain
www.pilgriment.com
the hosting company is digital city hosting
Please feel free to request any info that would help- I'm really at my wits end with this dUMB Button!
the database comes back and says "Access Denied"
The database I quess would be my domain
www.pilgriment.com
the hosting company is digital city hostingPlease feel free to request any info that would help- I'm really at my wits end with this dUMB Button!
Your domain is not a database, database being MYSQL etc?
and can you provide a like to the actual registration page so I can see whats wrong myself?
Here's is the entire code for Contact Form.PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contact Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {
background-color: #009999;
}
-->
</style></head>
<body class="sub">
<form action="http://www.pilgriment.com:2082/ContactForm.php/www.pilgriment/cgi-bin/cgiemail" method="post" name="ContactForm" id="ContactForm">
<table width="90%" border="0" cellpadding="8">
<tr>
<td colspan="3" bgcolor="#009999" class="HeaderColor"> <h4>Contact Form </h4> </td>
</tr>
<tr style="vertical-align: top">
<td style="text-align: right" class="LabelColor" nowrap="nowrap">
<label for="username">Preferred Name </label></td>
<td colspan="2" class="TitleColor">
<input type="text" id="username" name="textfield" />
<br />
Please type in the name or nickname you prefer to be addressed by. </td>
</tr>
<tr style="vertical-align: top">
<td style="text-align: right" class="LabelColor">
<label for="password">Phone</label> </td>
<td colspan="2" class="TitleColor"> <input type="text" id="password" name="textfield2" /> </td>
</tr>
<tr style="vertical-align: top">
<td style="text-align: right" class="LabelColor">
<label for="confirmpassword">Alt. Phone <br />
</label></td>
<td colspan="2" class="TitleColor">
<input type="text" id="confirmpassword" name="textfield3" /></td>
</tr>
<tr style="vertical-align: top">
<td style="text-align: right" class="LabelColor"> Name </td>
<td width="43%" class="TitleColor">
<label for="first">First: </label> <input type="text" id="first" name="textfield4" /> </td>
<td width="46%" class="TitleColor">
<label for="last">Last: </label> <input type="text" id="last" name="textfield5" /> </td>
</tr>
<tr style="vertical-align: top">
<td style="text-align: right" class="LabelColor">
<label for="email"> Email</label> </td>
<td colspan="2" class="TitleColor"> <input type="text" id="email" name="textfield6" size="50" /> </td>
</tr>
<tr style="vertical-align: top">
<td style="text-align: right" class="LabelColor"> Gender </td>
<td colspan="2"> <p class="TitleColor">
<label for="male">Male </label>
<input type="radio" id="male" name="radiobutton1" value="radiobutton" />
<label for="female">Female </label>
<input type="radio" id="female" name="radiobutton1" value="radiobutton" />
</p> </td>
</tr>
<tr style="vertical-align: top">
<td style="text-align: right" class="LabelColor"> Birth Date </td>
<td colspan="2"> <table border="0" cellspacing="2" cellpadding="0">
<tr style="text-align: left">
<td class="TitleColor">
<label for="month">MM </label>
<input type="text" id="month" name="textfield7" size="2" /> </td>
<td class="TitleColor">
<label for="day">DD </label>
<input type="text" id="day" name="textfield8" size="2" /> </td>
<td class="TitleColor">
<label for="year">YYYY </label>
<input type="text" id="year" name="textfield9" size="4" /> </td>
</tr>
</table> </td>
</tr>
<tr style="vertical-align: top">
<td height="195" colspan="3">
<p class="StoryContentColor">Are you looking to purchase a vehilce within 14 days or less? <br />
<label for="yes1">Yes </label>
<input type="radio" id="yes1" name="radiobutton2" value="radiobutton" checked="checked" />
<br />
<label for="no1"> No </label>
<input type="radio" id="no1" name="radiobutton2" value="radiobutton" />
</p>
<p class="StoryContentColor">Are you looking to purchase a New Vehicle? <br />
<label for="yes2">Yes </label>
<input type="radio" id="yes2" name="radiobutton3" value="radiobutton" checked="checked" />
<br />
<label for="no2"> No </label>
<input type="radio" id="no2" name="radiobutton3" value="radiobutton" />
</p> </td>
</tr>
</table>
<table width="90%" border="0" cellpadding="8">
<tr>
<td colspan="3" bgcolor="#009999" class="HeaderColor">Vehicle Informaiton </td>
</tr>
<tr style="vertical-align: top">
<td width="20%" nowrap="nowrap" bgcolor="#009999" class="LabelColor style4" style="text-align: right">
<label for="username">
<div align="left">Make </div>
</label></td>
<td colspan="2" bgcolor="#009999" class="TitleColor"><input name="textfield22" type="text" id="textfield2" />
If looking for Used Please type Used in this area </td>
</tr>
<tr style="vertical-align: top">
<td bgcolor="#009999" class="LabelColor style4" style="text-align: right">
<label for="password">
<div align="left">Model</div>
</label></td>
<td colspan="2" bgcolor="#009999" class="TitleColor"> <input type="text" id="password" name="textfield2" />
If Used please put type of vehicle, (or ID # from Product Page)- car, truck, suv, and if looking for specific engine or cyl # specify here. Ie: car 4 cyl, Truck 6cyl </td>
</tr>
<tr style="vertical-align: top">
<td bgcolor="#009999" class="LabelColor style4" style="text-align: right"><label for="email">
<div align="left">Adress</div>
</label> </td>
<td colspan="2" bgcolor="#009999" class="TitleColor"><p>
<input type="text" id="email" name="textfield6" size="50" />
</p>
<p>Street and Number - specify Apt. if Apartment </p></td>
</tr>
<tr style="vertical-align: top">
<td height="73" bgcolor="#009999" class="LabelColor style4" style="text-align: right">
<label for="confirmpassword">
<div align="left">City/Town</div>
</label> </td>
<td colspan="2" bgcolor="#009999" class="TitleColor style4"><br />
<input type="text" id="textfield32" name="textfield33" /></td>
</tr>
<tr style="vertical-align: top">
<td bgcolor="#009999" class="LabelColor" style="text-align: right"> <div align="left" class="style4">State and Zip </div></td>
<td width="38%" bgcolor="#009999" class="TitleColor style4">
<label for="first">State</label>
<input type="text" id="first" name="textfield4" /> </td>
<td width="42%" bgcolor="#009999" class="TitleColor style4">
<label for="last">Zip</label>
<input type="text" id="last" name="textfield5" /> </td>
</tr>
<tr style="vertical-align: top">
<td bgcolor="#009999" class="LabelColor" style="text-align: right"><div align="left" class="style4">Intent </div></td>
<td colspan="2" bgcolor="#009999"> <p class="TitleColor style4">
<label for="buy">Buy</label>
<input type="radio" id="buy" name="radiobutton1" value="radiobutton" />
<label for="Lease">Lease</label>
<input type="radio" id="Just looking" name="radiobutton1" value="radiobutton" />
<label for="justlooking">Just Looking</label>
<input type="radio" id="male" name="radiobutton1" value="radiobutton" />
</p> </td>
</tr>
<tr style="vertical-align: top">
<td colspan="3" bgcolor="#009999">
<p class="StoryContentColor style4">When would you like your sales representative to contact you? <br />
<label for="yes1">Day</label>
<input type="radio" id="yes1" name="radiobutton2" value="radiobutton" checked="checked" />
<br />
<label for="no1">Evening </label>
<input type="radio" id="no1" name="radiobutton2" value="radiobutton" checked="checked"/>
<p class="StoryContentColor style4">Are you interested in more than one make of vehicle? <br />
<label for="yes2">Yes </label>
<input type="radio" id="yes2" name="radiobutton3" value="radiobutton" checked="checked" />
If yes, what other models are you interested in? <span class="TitleColor">
<input type="text" id="textfield3" name="textfield32" size= "80
" />
</span><br />
<label for="no2"> No </label>
<input type="radio" id="no2" name="radiobutton3" value="radiobutton" />
</p> </td>
</tr>
<tr style="vertical-align: top" class="FooterColor">
<td colspan="3" bgcolor="#009999">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="22" align="right">
<param name="BGCOLOR" value="" />
<param name="movie" value="button33.swf" />
<param name="quality" value="high" />
<embed src="button33.swf" width="100" height="22" align="right" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" ></embed>
</object>
</a><input type="submit" name="SubmitName" value="Submit" /></span></td>
</tr>
</table>
</form>
</body>
</html>
Thanks- You Guys are Great!
Then the database would be part of the digital city hosting's site under my cpanel but I don't believe I have access to that outside of their website. It would be
c41530_Pilgrim on their site.
Ok you are using Cpanel11 and in this from what I see you are not in anyway using the database, problem resides with trying to submit your results via the :2082 port which is the Cpanel access port which only the site administrator (being you) can have access to.
I personally dont use cgi scripting to do any of my jobs, may I offer an alternative emailing system. Do some research into PHP's mail() function
http://www.php.net/manual/en/ref.mail.php
It will eliminate the aspect oh having to use any cgi scripting next to your PHP scripting.
But if you are intent on using the cgimailing script then do not submit the info via the 2082 port.
Hope I helped
It did help and when I click submit now on the web it does come up that it is contacting that page but it gets to a certain point and just hangs there. So I must have at least part of it correct now. Theproblem with using php alone is that I am not sure that my hosting site will allow it. Is there a way around that? If so where would it post to? can I send it to a regular email, or wouldit still go into my domain's email? If I can loop around this foolishness I ;m willing to try it.
Thandk YouAgain
Barb
PS: Now that i have it at least trying to contact the page that it submits to is there anything you guys know of that would keep it from posting on that end? I did put a copy of the ContactForm into the cgi bin for it to post to as was suggested on another site and the only difference between the two is that under Method = I put "get" instead of "post" should it be post or something else or by some very slim chance do I have it correct?? Please Advise!
Again you guys are absolute life savers and I will be happy to help others the same way in the future.
Thank You
Barb
Well I use the mail() function and am able to set from what email it comes from and where it is sent to.
I prefer to use it as I can set all detail's myself with ease.
Heres a simple function I use with mail()
function autoaemail($msg, $to2)
{
$subj = "WapTECH registration";
$headers = 'From: accounts@waptech.co.za' . "\r\n" .
'Reply-To: accounts@waptech.co.za' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to2, $subj, $msg, $headers);
}
As seen here this function sends out emails to the registrants on 1 of my sites with all their details.
You can create a new file which accepts the submitted information using $_POST global to accept all your info needed and build them into something like
$body = "
name: $username
Email: $usermail";
And as long as your spam filter does block their mail addies you should recieve all their mails. Tho you can also have all the emails come from 1 of your other alias'
Then you are sure you should receive the emails.
Thank you for trying to help but unfortunately I do not understand at all I have not yet learned php code. I would like to do it the way you described as it sounds much simpler and I can be assured of getting the information. but I would need nore info in order to do that I don;t even know how different php code is from html or xhtml.
If you are willing to provide more info I will try it. Otherwise maybe when I can research all the info I will try it. Thank You again,
Barbara