how to use php to save info - php

I am trying to follow along here in my book when building my website, I am trying to work on PHP/ .pl form saving, but I cannot seem to get it to work like it should.
<form action="/cgi-bin/contactlist.php" method="post">
<fieldset>
<legend>Join E-mail List Test blah blah</legend>
<p>This is a test and I am curious what it does so lol </p>
<ol>
<li>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</li>
<li>
<label for="email">Email:</label>
<input type="text`enter code here`" name="email" id="email" />
</li>
</ol>
<input type="submit" value="Submit" />
</fieldset>
</form>
</body>
</html>
The code listed above, but the form is not saving like it should, any suggestions?

Related

inserting a premade email contact form into website

I have very little knowledge of php so I went ahead and used one from css-tricks email forms he set up for free use:http://css-tricks.com/nice-and-simple-contact-form/.
However I am not sure how to put it into the website without breaking the php code. I assume I can't simply just take the code that I want, which is
<div id="contact-area">
<form method="post" action="contactengine.php">
<label for="Name">Name:</label>
<input type="text" name="Name" id="Name" />
<label for="City">City:</label>
<input type="text" name="City" id="City" />
<label for="Email">Email:</label>
<input type="text" name="Email" id="Email" />
<label for="Message">Message:</label><br />
<textarea name="Message" rows="20" cols="20" id="Message"></textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</form>
<div style="clear: both;"></div>
<p>Check out a version of this with SPAM protection.</p>
</div>
and put it into my html page. I tried using an iframe to link the html page into my html page for my website and it worked, but is this method ok?
Yes, you can just place that coding in your HTML page as long as all the webpage and css file's are linked correctly.(e.g. In the same folder as this page with the coding you have now.)
Using an i-frame for this is not a good idea as it can really mess up your pages and submitting your form.

Wordpress Custom Post Type Form Redirects to Page Not Found

I have been reading extensively about this and cannot seem to find a resolution. I have created a form in PHP which I want to submit to the same page I am on. I have read that there are some name's that wordpresses reserves such as "name" - which I am not using. Does anyone have any idea why this redirects to page not found upon submission?
http://hybridhosting.net/markeim/properties/52-coles-road/
<form action="" method="POST">
<input type="hidden" id="my_favorite_nonce" name="my_favorite_nonce" value="a87e4a44aa"><input type="hidden" name="_wp_http_referer" value="/markeim/properties/52-coles-road/"> <input type="hidden" name="form_title" value="brokercontact">
<input type="hidden" name="brokers" value="testemail#gmail.com">
<p>
Your Name
<span>
*
</span>
<br>
<input type="text" id="yourname" name="yourname" class="ink">
</p>
<p>
Your E-mail
<span>
*
</span>
<br>
<input type="text" id="youremail" name="youremail" class="ink">
</p>
<p>
Your Message
<span>
*
</span>
<br>
<textarea cols="" rows="" id="yourmessage" name="yourmessage" class="lab"></textarea>
</p>
<p>
<input type="submit" class="sending" value="Contact Broker">
</p>
</form>
It's something to do with your hidden input fields, not sure what. When I delete the nodes from dev tools and submit the form, it goes through fine!
Delete the hidden input field with name="brokers" and you'll see
I'm guessing WP uses the term "brokers" for something, please see here:
http://contactform7.com/faq/are-there-any-reserved-or-unavailable-words-for-the-name-of-an-input-field/

Open PHP Page On Button Click

I wonder whether someone could help me please.
I'm put together the following form contained within a PHP file.
<form name="savemyfindstolocation" id="savemyfindstolocation" method="post">
<p><label></label>
</p>
<p align="left">
<input name="userid" type="text" id="userid"/>
<input name="locationid" type="text" id="locationid"/>
<br />
</p>
<div>
<label>
<div align="left">Click on the map to place the marker for the find that has been made and drag until the precise location has been found. </div>
</div>
<p align="left"><label>Find OSGB36 Latitude Co-ordinate<br />
</label>
</p>
<div>
<div align="left">
<input name="findosgb36lat" type="text" id="findosgb36lat" size="20" />
</div>
</div>
<p align="left"><label>Find OSGB36 Longitude Co-ordinate<br />
</label>
</p>
<div>
<div align="left">
<input name="findosgb36lon" type="text" id="findosgb36lon" size="20" />
</div>
</div>
<p align="left"><label>Date of Trip<br />
</label>
</p>
<div>
<div align="left">
<input name="dateoftrip" type="text" id="dateoftrip" size="10" />
</div>
</div>
<input name="submit" type="submit" onclick="MM_callJS('savedata()')" value="Submit" />
</form>
It all works fine, but I'd now like to add a button that opens the following php page, 'blobupload.php'. If I've understood this correctly from the research that I've done, I need to use javascript to open the page, using the 'submit' action from the main form.
What I don't understand is how to do this when the 'submit' action is already taken for the saving of the information on the main form.
Could someone perhaps please show me how to get around this, i.e. using the same 'submit action but for two different purposes.
Just modify your form tag (add the action attribute to file you want to load):
<form name="savemyfindstolocation" id="savemyfindstolocation" method="post" action="blobupload.php">
And you submit input tag:
<input name="submit" type="submit" value="Submit" />
You can use a second javascript function to open new window like this way
<input name="submit" type="submit" onclick="MM_callJS('savedata()');SECOND_JS_FUNCTION()" value="Submit" />
Use php to process the form is one of the way to do it.
<input name="submit" !!!!!!action="process.php" method="POST (or get)!!!!!!!!!! type="submit" onclick="MM_callJS('savedata()')" value="Submit" />
that way the the variable will be passed to the process.php while you can also redirect the page in the process.php
header("Location:URL");

Error with html post form in internet explorer

I have a html form which posts to a php script. It works fine in chrome and firefox but not in IE. I have ran a test on W3C but can not find any errors that relate to the form. My code is:
<form class="formular" id="formular" method="post" action="script/contact.php">
<fieldset>
<label>
<span>Name : </span>
<input type="text" class="validate['required','length[3,-1]','nodigit'] text-input" name="Name" />
</label>
<label>
<span>Email address : </span>
<input type="text" class="validate['required','email'] text-input" name="email" />
</label>
</fieldset>
<div class="button">
<input type="submit" value="Contact" class="submit" />
</div>
</form>
Thanks in advance
Form is correct. Looks like wrong handling form on server side. how you catch result?

Form not sending full data

I have a form with over 50 input fields. The input fields are divided into 5 jquery jabs within the form container. Here's a sample of what it looks like:
<form action="admin/save" method="post" enctype="multipart/form-data">
<input type="hidden" name="type" value="department" />
<input type="hidden" name="id" value="21" />
<div id="tabs">
<ul>
<li>Tab 1<li>
<li>Tab 2<li>
<li>Tab 3<li>
</ul>
<div id="tab-1">
<label>Name</label>
<input type="text" name="user-name" />
</div>
<div id="tab-2">
<label>Address</label>
<input type="text" name="user-address" />
</div>
<div id="tab-3">
<label>Phone</label>
<input type="text" name="user-phone" />
</div>
</div>
<input type="submit" value="Send" />
</form>
I'm using PHP's Kohana framework, so admin maps to a controller, and save maps to the method action_save.
When I output the $_POST variables in action_save, only 'type' and 'id' show up, all the other fields don't seem to submit their data.
What could I be doing wrong?
Have you tried this with different browsers and sniffed the network traffic to see exactly what's being sent?
Grab Firebug and make sure it's actually sending the POST data.

Categories