New input not posted [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've got a form with 6 inputs of different types (select, radio, text...). When I debug with Xdebugg I can see the values in $_POST variable,
I've decided to add other input but they arent posted : when I look at $_POST variable, I just have the first 6 values.
Here's a part of my form :
edit : i've copy/paste the code this time. My boss told me to not send the real code, that's why I've send a fake code but i really need some help so here's the real one.
<div id="modifierUser" class="divAdmin">
<form id="modifierUserForm" name="modifier_user"action="includes/inc_adminModifierUser.php">
<fieldset>
<legend>
<img src="img/bulle_48.png" alt="bulle" title="bulle" />
<h3>Modifier le compte</h3><br />
</legend>
<!-- the field i've tried to add -->
<label class ="labelEmail" for="idmembre">ID du membre </label>
<input id="idmembre" name="idmembre" size="35" class="required"/>
<!-- -->
<label class ="labelEmail" for="pseudo">Utilisateur </label>
<input id="pseudo" name="pseudo" size="35" class="required"/>
<label class ="labelEmail" for="anneeNaiss">Année de naissance </label>
<input id="anneeNaiss" name="anneeNaiss" placeholder="e.g : 1984" size="35" class="required" maxlength="4" value="" />
<label class ="labelEmail" for="email">Email </label>
<input id="mail" type="email" name="email" size="35" class="email" value="" maxlength="50"/>
<label class ="labelEmail" for="telephone">Téléphone</label>
<input id="telephone" type="tel" name="telephone" size="35" class="required" value="" maxlength="10" />
<label class ="labelEmail"> Masquer numéro dans l'annonce</label>
<input type="radio" name="masquerTel" value="oui" id="oui" checked="checked" />
<span>Oui</span>
<input type="radio" name="masquerTel" value="non" id="non" /><span>Non</span>
<label class ="labelEmail" for="region">Région</label>
<select id="region" name="region" size="1" class="required" style="width:180px"
<option value="Aquitaine" selected="selected" >Aquitaine </option>
<option value="Alsace">Alsace </option>
<!-- There's many options there-->
</select>
<input type="submit" name="enregistrer" value="Enregistrer les modifications" size="35"/>
<input type="button" name="annuler" class="annuler" value="ANNULER" />
</fieldset>
</form>
</div><!--fin modifierUser-->
variable i can see :
$_POST['pseudo']
$_POST['anneNaiss']
$_POST['email']
$_POST['telephone']
$_POST['masquerTel']
$_POST['region']
i'll always have $_POST[6]in xdebug, no matter how many input i add. But i tried to suppress one of 6 above input and i got $_POST[5].
The one I need to see
$_POST['idmembre']
Sorry for wasting your time

It looks as if the values aren't being posted because you've mispelt "action", calling it "ation" in the form element starting tag. <form>.
Because of this your form will be posting to the same page it's output in, rather than the page you're trying to POST the data to.
The first line of your code should look like this instead:
<form id="modifyUserForm" name="modify_user" action="includes/inc_adminModifyUser.php">

it seems that you have an extra double quote in your code so thats normal you HTML code does not render correctly:
<input id="inp_realname" name="realname" size="35" "/>
should be:
<input id="inp_realname" name="realname" size="35" />

Related

When uploading file, it show error message (PHP) [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 months ago.
Improve this question
I try to upload a Image by using PHP. I need to save image in my database. this is my HTML file. I dont know how to pass data file
<form action="insert.php" method="post">
<p>
<label for="firstName">First Name:</label>
<input type="text" name="first_name" id="firstName">
</p>
<p>
<label for="lastName">Last Name:</label>
<input type="text" name="last_name" id="lastName">
</p>
<p>
<label for="Gender">Gender:</label>
<input type="text" name="gender" id="Gender">
</p>
<p>
<label for="Address">Address:</label>
<input type="text" name="address" id="Address">
</p>
<p>
<label for="emailAddress">Email Address:</label>
<input type="text" name="email" id="emailAddress">
</p>
<input type="submit" value="Submit">
</form>
Use enctype='multipart/form-data'
<form action="insert.php" method="post" enctype='multipart/form-data'>

Subscriptions Addon is not working in Expression Engine

I purchased subscription addon from here, but its not working I have successfully installed it and its showing in my admin panel but when i write below code its not showing anything to me on my page.
{exp:subs:subscribe register_member="yes" plan="{segment_3}" payment_method="stripe" return="/account/subscription/%SUBS_HASH%"}
<h1>Subscribe to: {subs:plan:label}</h1>
<p>
Every <strong>{subs:plan:recurring_interval_count} {subs:plan:recurring_interval}</strong> {subs:plan:recurring_amount} {subs:plan:currency}
</p>
<hr>
{if subs:total_errors}
<ul class="errors">
{subs:form_errors}
<li>{subs:error}</li>
{/subs:form_errors}
</ul>
{/if}
<h3>Credit Card</h3>
<label>Credit Card Number</label>
<input name="card_number" type="text" value="{subs:card_number}">
<label>Name on card</label>
<input name="card_name" type="text" value="{subs:card_name}">
<label>Expires</label>
<select name="card_exp_month">{subs:month_options}</select>
<select name="card_exp_year">{subs:year_options}</select>
<label>Security Code</label>
<input name="card_cvc" type="text" value="{subs:card_cvc}" size="5">
<button type="submit">Subscribe</button>
{/exp:subs:subscribe}
I used their example code you can find it here.
please help me thanks in advance.
Your page is showing blank because page is not getting {segment_3} i.e. plan i hope you have not create any plan or if created then you have not passed them as {segment_3}. To test this thing use below code it will be helpful for you.
{exp:subs:subscribe register_member="yes" plan="gold" payment_method="stripe" return="/account/"}
<h1>Subscribe to: {subs:plan:label}</h1>
<p>
Every <strong>{subs:plan:recurring_interval_count} {subs:plan:recurring_interval}</strong> {subs:plan:recurring_amount} {subs:plan:currency}
</p>
<hr>
{if subs:total_errors}
<ul class="errors">
{subs:form_errors}
<li>{subs:error}</li>
{/subs:form_errors}
</ul>
{/if}
{if logged_out}
<h3>User Account</h3>
<label>Username</label>
<input type="text" name="username" value="">
<label>Email</label>
<input type="text" name="email" value="">
<label>Password</label>
<input type="password" name="password" value="">
<label>Password Confirm</label>
<input type="password" name="password_confirm" value="">
{/if}
<h3>Credit Card</h3>
<label>Credit Card Number</label>
<input name="card_number" type="text" value="{subs:card_number}">
<label>Name on card</label>
<input name="card_name" type="text" value="{subs:card_name}">
<label>Expires</label>
<select name="card_exp_month">{subs:month_options}</select>
<select name="card_exp_year">{subs:year_options}</select>
<label>Security Code</label>
<input name="card_cvc" type="text" value="{subs:card_cvc}" size="5">
<button type="submit">Subscribe</button>
{/exp:subs:subscribe}
make a plan named gold or abc whatever you want must put the same name at plan="plan_name" at the first line you can see it and remember for Visa cards it requires some more fields you may get fields error for this you have to use that fields you can find those fields on devdemon website.
enjoy !!!

Pre checked check box [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a site that has multiple ways to access our "email me for more information" form.
On the form, it has a list of checkboxes that they can check that they want to be emailed about more information for. Is it possible to have the check box prechecked depending on what page they come from?
For example, they visit our "Product 12" page and follow the link to the form and there is a checkbox to receive more information on Product 12 that is pre-checked because they came to the form from the Product 12 page.
Here is my form code:
<form id="formElem" name="formElem" action="" method="post">
<fieldset class="step">
<legend>Personal Details</legend>
<p>
<label for="fullname">Full Name</label>
<input id="fullname" name="username" />
</p>
<p>
<label for="company">Company Name</label>
<input id="company" name="company" />
</p>
<p>
<label for="title">Title</label>
<input id="title" name="title" />
</p>
<p>
<label for="phone">Phone Number</label>
<input id="phone" name="phone" />
</p>
<p>
<label for="email">Email</label>
<input id="email" name="email" placeholder="info#.com" type="email" AUTOCOMPLETE=OFF />
</p>
</fieldset>
<fieldset class="step">
<legend>Products I'm interested in...</legend>
<p>
<input type="checkbox" name="telematics" value="telematics">Telematics<br>
</p>
<p>
<input type="checkbox" name="controllers" value="controllers">Controllers<br>
</p>
<p>
<input type="checkbox" name="cots" value="cots">Custom-off-the-Shelf<br>
</p>
<p>
<input type="checkbox" name="displays" value="displays">Displays\Operator Interfaces<br>
</p>
<p>
<input type="checkbox" name="cordReels" value="cordreels">Cord Reels<br>
</p>
<p>
<input type="checkbox" name="pdm" value="pdm">Power Distribution Modules<br>
</p>
<p>
<input type="checkbox" name="rtc" value="rtc">Real Time Clock<br>
</p>
</fieldset>
<fieldset class="step">
<legend>Services I'm interested in...</legend>
<p>
<input type="checkbox" name="productDev" value="productdev">Product Development<br>
</p>
<p>
<input type="checkbox" name="desEng" value="deseng">Design Engineering<br>
</p>
<p>
<input type="checkbox" name="dfx" value="dfx">DFX<br>
</p>
<p>
<input type="checkbox" name="transServices" value="transServices">Transition Services<br>
</p>
<p>
<input type="checkbox" name="stratSourcing" value="stratSourcing">Strategic Sourcing<br>
</p>
<p>
<input type="checkbox" name="planning" value="planning">Planning<br>
</p>
<p>
<input type="checkbox" name="manufacturing" value="manufacturing">Manufacturing<br>
</p>
<p>
<input type="checkbox" name="fullfillment" value="fullfillment">Fullfillment<br>
</p>
<p>
<input type="checkbox" name="prodLifecycle" value="prodLifecycle">Product Life-Cycle Management<br>
</p>
</fieldset>
<fieldset class="step">
<legend>Confirm</legend>
<p>Everything in the form was correctly filled
if all the steps have a green checkmark icon.
A red checkmark icon indicates that some field
is missing or filled out with invalid data.
</p>
<p class="submit">
<button id="registerButton" type="submit">Register</button>
</p>
</fieldset>
</form>
The serverside code will be PHP.
Plz respond.
If I was in your shoes, I would use a query string variable to pass the ID of your page (or product ID would be ideal) on the link linking your product page to the form.
ie.) /formPage.html?id=12
On the form page, give each input element a unique ID. Then using either server side code or javascript, check if the id is present in the querystring, if so, check what it is and programatically check your checkbox.
It's easy with jquery:
$("#product12ID").prop("checked", true); <---- This will check the checkbox that has an id=product12ID
It would be helpful to know what language you're using (ASP.NET, PHP, etc). It would help fine tune what direction to go in.

Exporting data from an HTML form into an XML document

Alright here is what I am attempting to do. I have a form written in HTML. It has a few HTML5 elements to it though. What I would like to happen, is when the user fills out all the required fields (validated with PHP and some HTML5) and submits the form, it will export to an existing XML file. The form also uses AJAX to validate as the user fills out the fields, and to validate the form as a whole (once submitted) without reloading my page.
The XML file is just a framework of empty tags set up to receive the information from form submissions, built upon a schema (I made) to restrict it to certain values and what not. I would also need to be able to have a script to validate the new XML values against the schema to make sure all values are valid, and if not return an error message.
The XML Schema validation is as close as possible to the PHP validation with a few character amount limits added in here and there.
If you need me to post the schema for the XML file in order to give a more specific answer then I will upon request.
XML Framework:
<form>
**<!-- First Name -->**
<fname></fname>
<!-- Last Name -->
<lname></lname>
<!-- Phone Number -->
<phone></phone>
<!-- Email -->
<email></email>
<!-- Website -->
<website></website>
<!-- Subject -->
<subject></subject>
<!-- Message -->
<message></message>
</form>
HTML Form:
<form method="post" action="php/validator.php" name="contactform" id="contactform" autocomplete="on">
<fieldset>
<legend>Contact Details</legend>
<div>
<label for="fname" accesskey="F">Your First Name*</label>
<input name="fname" type="text" id="name" placeholder="Enter your first name" tabindex="1" required />
</div>
<div>
<label for="lname" accesskey="L">Your Last Name*</label>
<input name="lname" type="text" id="name" placeholder="Enter your last name" tabindex="2" required />
</div>
<div>
<label for="email" accesskey="E">Email*</label>
<input name="email" type="email" id="email" placeholder="myEmail#example.com" pattern="^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)#([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$" tabindex="3" required />
</div>
<div>
<label for="phone" accesskey="P">Phone <small>(optional)</small></label>
<input name="phone" type="tel" id="phone" size="12" placeholder="555-555-5555" tabindex="4" />
</div>
<div>
<label for="website" accesskey="W">Website <small>(optional)</small></label>
<input name="website" type="url" id="website" placeholder="www.yourWebDomain.com" tabindex="5" />
</div>
</fieldset>
<fieldset>
<legend>Your Comments</legend>
<div>
<label for="subject" accesskey="S">Subject*</label>
<select name="subject" id="subject" tabindex="6" required="required">
<option value=""></option>
<option value="Support">Support</option>
<option value="Sale">Sales</option>
<option value="Bug">Report a bug</option>
<option value="Other">Other</option>
</select>
</div>
<div>
<label for="comments" accesskey="C">Comments*</label>
<textarea name="comments" cols="40" rows="3" id="comments" class="comments" placeholder="Enter your comments" spellcheck="true" required tabindex="7"></textarea>
</div>
</fieldset>
<input type="submit" class="submit" id="submit" value="Submit" tabindex="9" />
</form>
After validation use PHP to capture the form fields, wrap them in XML elements, then save it.
e.g.
<form>
<fname><?php=$_REQUEST['fname']?></fname>
<lname><?php=$_REQUEST['lname']?></lname>
...
..
</form>
No sense in double validation either, with one slightly different than the other. It would be annoying for the user to submit their data successfully but somehow get rejected in the backend without warning. DOMDocument is a little overkill as well.
PHP contains a class called DOMDocument specifically for the purpose of building, altering, importing and exporting XML data. If you are familiar with constructing DOM elements in Javascript, it is the same idea. Create your DOMDocument, then create each element and append those elements to DOMDocument (or that element's parent) after you've made them. After you're done there, use the save function to write it to a file.

Passing php form info to javascript form

I hope someone can help me. I'm a little at loss on how I can achive this: I'm trying to pass infos generated in my php to another form made in Javascript. For example, if I put my first name in the input field and click submit, then it would go to another page with the actual form and have the first name already filled there.
One thing that I did notice was that the javascript form isn't within the <form> tag, it's in a bunch of tables with some input fields. I can post what it looks like in pastebin if this can help in understanding what I mean.
Also with this script im unable to edit it, I did not make it, it is one of those script you just place on your site thats auto generated.
My form looks like this:
<form action="auto-form/index.php" method="post" name="openleads" onsubmit="return checkForm(this);">
<label for="first">First Name <span class="required">*</span></label>
<input id="first_name" type="text" name="first" applicationforms="true" /><br>
<label class="error" for="name" id="first_name_error" style="color:#F00; font-size:11px;">This field is required.</label>
<span class="fields">Zip <span class="required">*</span></span>
<input id="zip" type="text" name="zip" applicationforms="true" /><br>
<label class="error" for="name" id="zip_error" style="color:#F00; font-size:11px;">This field is required.</label>
<label for="last">Last Name <span class="required">*</span></label>
<input id="last_name" type="text" name="last" applicationforms="true" /><br>
<label class="error" for="name" id="last_name_error" style="color:#F00; font-size:11px;">This field is required.</label>
<span class="fields">Email <span class="required">*</span></span>
<input id="email" type="text" name="email" applicationforms="true" /><br>
<label class="error" for="name" id="email_error" style="color:#F00; font-size:11px;">This field is required.</label>
<input class="button" type="submit" name="send" value="Send" />
</form>
Any help is appreciated; like I said, I'm a bit at loss on what to do with this one.
php-form.php
<form action="javascript-form.php" method="post">
<input type="text" name="name" />
<input type="submit" value="Submit" />
</form>
javascript-form.php
<form action="" method="">
<input type="text" name="name" value="<?= (isset($_POST['name'])?htmlentities($_POST['name'],ENT_QUOTES):''); ?>" />
<input type="submit" value="Submit" />
</form>
Use PHP to output the POSTed values in to the value attribute of the form fields. You can also use GET variables and use javascript to parse the window.location and scrape those form values.
this seemed to get this done
<script type="text/javascript" src="http://jquery.offput.ca/js/jquery.timers.js"></script>
<script>
$(document).everyTime(1000,function(i){
if($('#ui-datepicker-div').length>0)
{
$('#first_name').val('<?php echo $_POST['first_name']; ?>');
$('#last_name').val('<?php echo $_POST['last']; ?>');
$('#zip').val('<?php echo $_POST['zip']; ?>');
$('#email').val('<?php echo $_POST['email']; ?>');
}
})
$('#first_name').val('test');
</script>

Categories