how to customize my Google form - something is wrong - php

I want to customize my google form, and I almost got it right. It's just one field that is not working. It's the first field in this page: http://hagefornyelse.no/gratis-befaring/
The entries in the first field is not registrated. But all other fields is working properly. What have I done wrong?
Here is the code I have made that regards the first field in the http://hagefornyelse.no/gratis-befaring page:
<div class="ss-form-container">
<div class="ss-form"><form id="ss-form" action="https://docs.google.com/spreadsheet/formResponse?formkey=dGFvbzZqVWtOT3RBemdXZzVEbWREYWc6MQ&ifq" method="POST">
<div class="errorbox-good">
<div class="ss-item ss-text">
<div class="ss-form-entry"><label class="ss-q-title" for="entry_0">Hva ønsker du hjelp til?
</label><input id="entry_0" class="ss-q-short" name="entry.0.single" type="text" value="" />
</div>
</div>
</div>
And here is the code from the Google form.
<div class="ss-form-question errorbox-good" role="listitem">
<div dir="ltr" class="ss-item ss-text»>
<div class="ss-form-entry">
<label class="ss-q-item-label" for="entry_2444089»>
<div class="ss-q-title">Hva ønsker du hjelp til?
</div>
<div class="ss-q-help ss-secondary-text" dir="ltr»>
</div>
</label>
<input type="text" name="entry.2444089" value="" class="ss-q-short" id="entry_2444089" dir="auto" aria-label="Hva ønsker du hjelp til? " title="»>
<div class="error-message" id="1918730340_errorMessage»>
</div>
<div class="required-message">Dette er et obligatorisk spørsmål
</div>
</div>
</div>
</div>
What have I done wrong in the first field "Hva ønsker du hjelp til?" ?

Related

MPDF causing issue with html string

I have editable pdf form that needs to be build for this i used mpdf, now for sample html an html with an <input type="text" name="demo"/> it workds perfectly fine it generates the required editable pdf as it should,now i have created a form the link is
http://clients.nextcrawl.co/simpleservant-form/
it is just a simple index, css and some fonts when i try to render this html into mpdf i got the following error!
Notice: Undefined index: fieldname in E:\xampp\htdocs\simpleservant-form\vendor\mpdf\mpdf\src\Form.php on line 204
Fatal error: Call to undefined method Mpdf\Mpdf::Error() in E:\xampp\htdocs\simpleservant-form\vendor\mpdf\mpdf\src\Form.php on line 829
i am fairly new with these things, so i cant really figure where the problem is, here's my full code
<?php
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$html='
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/form.css"/>
</head>
<body>
<div class="container">
<div class="notification_form">
<div class="form-header clearfix">
<div class="align1">
<h2>
<span>ONTARIO COURT OF JUSTICE</span><br/>
COUR DE JUSTICE DE L’ONTARIO<br/>
<span>PROVINCE OF ONTARIO</span><br/>
PROVINCE DE L’ONTARIO
</h2>
</div>
<div class="align2">
<h1>NOTICE OF INTENTION TO APPEAR<br/>
<span>AVIS D’INTENTION DE COMPARAÎTRE</span></h1>
</div>
<div class="align3">
<h3>
<span class="bold">Form / Formulaire 8</span><br/>
<span class="italic-form">Provincial Offences Act</span><br/>
Loi sur les infractions provinciales
</h3>
</div>
</div>
<div class="form_content">
<div class="consent">
<div class="fields-bottom fields-1">
<div class="flex1">
<p>TAKE NOTICE THAT I,</p>
</div>
<div class="flex2">
<input type="text" class="long"/>
<div class="half-width">
<p class="italic-form">VEUILLEZE PRENDRE AVIS QUE JE SOISSIGNĖ(E)</p>
<p class="font-size-kum">(Family/Company / <span class="italic-form">nom de famille/enterprise</span>)</p>
</div>
</div>
<div class="flex3">
<input type="text"/>
<div class="half-width">
<p>(Given / <span class="italic-form">prėnom</span>)</p>
</div>
</div>
<div class="flex4">
<input type="text" class="last"/>
<div class="quarter-width">
<p class="right">(Initials / <span class="italic-form">initiales</span>)</p>
</div>
</div>
</div>
<div class="fields-bottom fields-2">
<div class="flex1">
<input type="text">
<p>(Current address / <span class="italic-form">adresse actuelle</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Street / <span class="italic-form">rue</span>)</p>
</div>
<div class="flex3">
<input type="text">
<p>(Apt. / <span class="italic-form">app</span>.)</p>
</div>
</div>
<div class="fields-bottom fields-2 fields-3">
<div class="flex1">
<input type="text">
<p>(Municipality / <span class="italic-form">municipalitė</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Province)</p>
</div>
<div class="flex3">
<input type="text">
<p>(Postal Code / <span class="italic-form">code postal</span>)</p>
</div>
</div>
<div class="fields-bottom fields-4">
<div class="flex1">
<input type="text">
<input type="text">
<input type="text">
<p>(Telephone No / <span class="italic-form">numėro du tėlėphone</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(E-mail Address / <span class="italic-form">adresse de courriel</span>)</p>
</div>
</div>
<div class="fields-bottom fields-5">
<div class="flex1">
<input type="text">
<p>(Location # /<br/>
<span class="italic-form">emplacement #</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Offence number /<br/>
<span class="italic-form">numėro de l’infraction</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Offence date: day/month /<br/>
<span class="italic-form">date de l’infraction:jour/mois</span>)</p>
</div>
</div>
<span>wish to give notice of my intention to appear in court to enter a plea of not guilty at the time and place set for the trail respecting the charge set out in the
Offence Notice or Parking Infraction Notice.</span>
<span class="italic-form">dėsire donner avis de mon intention de comparaître devant le tribunal pour inscrire un plaidoyer de non-culpabilitė à l’heure et au lieu prėvus pour
le procės en rėponse à l’accusation ėnoncėe dans l’avis d’infraction ou l’avis d’infraction de stationnement.</span>
<div class="court fields-bottom">
<div class="block">
<input type="radio" name="appear"/>
<p>I intend to appear in court to enter a plea at the time and place set for the trial and I wish that it be held in the English lanuage</p>
</div>
<div class="block">
<input type="radio" name="appear"/>
<p class="italic-form">J’ai l’intention de comparaître decant le tribunal pour inscrire un plaidoyer à l’heure et au lieu prėvus pour le precės et je dėsire que le procės
se dėroule en francais</p>
</div>
</div>
<div class="fields-bottom fields-6">
<div class="flex1">
<p>I request a</p>
<input type="text">
<p>language interpreter for the trial.</p>
</div>
<div class="flex2">
<p>(leave blank if inaplicable)</p>
</div>
</div>
<div class="fields-bottom fields-6 fields-7">
<div class="flex1">
<p class="italic-form">Je demande l’aide d’un interprėte de langue</p>
<input type="text">
<p class="italic-form">pour le precės.</p>
</div>
<div class="flex2">
<p class="italic-form">(à remplir, s’il y a lieu)</p>
</div>
</div>
<div class="sign">
<div class="sign1">
<p><span>Note:</span> if you <span>fail to notify</span> the court office of <span>address changes</span> you may not
receive important notices e.g., your Notice of trial. You may be convicted in
your absence if you do not attend the trial.</p>
<input type="text"/>
<p class="sign-p">Signature of defendant /<br/>
<span class="italic-form">signature du dėfendeur / de la dėfenderesse</span> </p>
</div>
<div class="sign2">
<p class="italic-form"><span>Remarque:</span> Si vous <span>omettez de prėvenir</span> le greffe du tribunal de
<span>tout changement d’adresse</span>, vous pouriez ne pas recevoir
d’importants avis (p.ex.,votre avis de procės). Vous pourriez
ėtre dėclarė(e) coupable en votre absence si vous n’assistez pas
au procės.</p>
<p class="middle">Date</p>
<input type="text" class="middle"/>
</div>
</div>
</div>
<div class="border-parent">
<div class="dashed-border"></div>
</div>
<div class="consent">
<div class="banda-sign">
<p>Representative’s Name & Address / <span class="italic-form">non et adresse du reprėsentant / de la reprėsentate</span></p>
</div>
<div class="fields-bottom fields-8">
<div class="flex1">
<input type="text">
<p>(Name / <span class="italic-form">nom</span>)</p>
</div>
</div>
<div class="fields-bottom fields-2 fields-9">
<div class="flex1">
<input type="text">
<p>(Current address / <span class="italic-form">adresse actuelle</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Street / <span class="italic-form">rue</span>)</p>
</div>
<div class="flex3">
<input type="text">
<p>(Apt. / <span class="italic-form">app</span>.)</p>
</div>
</div>
<div class="fields-bottom fields-2 fields-3 fields-9">
<div class="flex1">
<input type="text">
<p>(Municipality / <span class="italic-form">municipalitė</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Province)</p>
</div>
<div class="flex3">
<input type="text">
<p>(Postal Code / <span class="italic-form">code postal</span>)</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>';
$mpdf->useActiveForms = true;
//$mpdf->formUseZapD = false;
//$mpdf->form_border_color = '0.6 0.6 0.72';
//$mpdf->form_button_border_width = '2';
//$mpdf->form_button_border_style = 'S';
//$mpdf->form_radio_color = '0.0 0.0 0.4'; // radio and checkbox
//$mpdf->form_radio_background_color = '0.9 0.9 0.9';
$mpdf->WriteHTML($html,0);
$mpdf->Output();
//$mpdf->WriteHTML($html);
//// OUTPUT
//$mpdf->Output(); exit;
i am indeed using composer for library management , can anyone help what maybe the issue?
The Call to undefined method Fatal error is fixed in a fresh version 7.1.6, upgrade from composer.
As to the undefined index, file an issue in mPDF Github issue tracker.

Why does my number input put an "<" in front of my numbers?

So the problem is that i have a input type number just like any other regular input type number, but for some reason that am not able to understand it put a "<" sign in front of my numbers.
<div class="child">
<div class="label-form">
<label for="numC">Numero de Contrato:</label>
</div>
<?php while($vector2=mysqli_fetch_array($resultado2)) { ?>
<div class="input">
<?php echo $vector2[0]+1;?>
<input type="hidden" name="NumeroContrato" value="<?php echo $vector2[0]+1;?>">
</div>
</div>
<?php } ?>
<div class="child">
<div class="label-form">
<label for="nMota">Numero da mota</label>
</div>
<div class="input">
<input type="number" id="nMota" name="nMota" placeholder="Bike Number" required>
</div>
</div>
Its the "nMota" input; for example if i put a 1 it receive the information as <1 if i put a 7 it put <7. I have no idea why.

Inserting data into MySQL server

I'm doing a e-commerce admin panel and I need a quick script for inserting data into MySQL. Here's what i've done and it does nothing.
<form action="#" id="form_sample_1" class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label">Package Name<span class="required">*</span></label>
<div class="controls">
<input type="text" name="pkg_name" data-required="1" class="span6 " value=""/>
</div>
</div>
<div class="control-group">
<label class="control-label">Package Price <span class="required">*</span><small>(In Dollars)</small></label>
<div class="controls">
<input name="pkg_price" type="number" class="span6 " value=""/>
</div>
</div>
<div class="control-group">
<label class="control-label">Package Contains</label>
<div class="controls">
<input name="pkg_contains" type="text" class="span6 " value=""/>
</div>
</div>
<div class="control-group">
<label class="control-label">Your Password</label>
<div class="controls">
<input name="sifre" type="password" class="span6 " value=""/>
</div>
</div>
<div class="form-actions">
<button type="button"name="btn" class="btn btn-primary">Send request to server.</button>
</div>
</form>
<!-- END FORM-->
</div> <!--widget box light-grey end-->
<!-- Mass PHP starts here! -->
<?php
echo mysql_error();
include("include/baglan.php");
// set posts here.
$_POST['pkg_name'] = $pkg_name;
$_POST['pkg_price'] = $pkg_price;
$_POST['pkg_contains'] = $pkg_contains;
$sifre = mysql_real_escape_string(md5($_POST['sifre']));
if($_POST['btn'] and $_POST["sifre"] = $sifre){
mysql_query("INSERT INTO packages (pkg_name, pkg_price,pkg_contains) VALUES $pkg_name $pkg_price $pkg_contains");
echo "Success.";
}
else {
echo mysql_error();}
It returns nothing! I've re-written all code but nothing! please help me. The databae variables are;
id, auto incerment
pkg_name text
pkg_price int
pkg_contains mediumtext
Assign variable name should be the left side.
// set posts here.
$pkg_name=$_POST['pkg_name'];
$pkg_price=$_POST['pkg_price'];
$pkg_contains=$_POST['pkg_contains'];
Values() is function, put all vars in bracket and split them with ','.
mysql_query("INSERT INTO packages (pkg_name, pkg_price,pkg_contains) VALUES($pkg_name,$pkg_price,$pkg_contains)");

HTML/PHP Form not working

I have a HTML Form that uses partial PHP to grab the value, the form is basically like an edit account details form.
The Problem
I cannot work out why the form is not working and when using notepad++ to edit my code if I click on the it shows the start to be a DIV which just confuses the matter even more... When submitting the form it takes you back to the form page with no message so I am lost for a reason..
Form Page
<form method="POST" action="dev.php">
<!-- Row -->
<div class="row-fluid">
<!-- Column -->
<div class="span6">
<!-- Group -->
<div class="control-group">
<label class="control-label" for="fname">First name</label>
<div class="controls">
<input type="text" name="fname" id="fname" value="<?php echo $user_fname; ?>" class="span10" />
<span style="margin: 0;" class="btn-action single glyphicons circle_question_mark" data-toggle="tooltip" data-placement="top" data-original-title="First name is mandatory"><i></i></span>
</div>
</div>
<!-- // Group END -->
<!-- Group -->
<div class="control-group">
<label class="control-label" for="lname">Last name</label>
<div class="controls">
<input type="text" name="lname" id="lname" value="<?php echo $user_sname; ?>" class="span10" />
<span style="margin: 0;" class="btn-action single glyphicons circle_question_mark" data-toggle="tooltip" data-placement="top" data-original-title="Last name is mandatory"><i></i></span>
</div>
</div>
<!-- // Group END -->
</div>
<!-- // Column END -->
<!-- Column -->
<div class="span6">
<!-- Group -->
<div class="control-group">
<label class="control-label" for="email">Email Address</label>
<div class="controls">
<input type="text" name="email" id="email" value="<?php echo $user_email; ?>" class="span10" />
<span style="margin: 0;" class="btn-action single glyphicons circle_question_mark" data-toggle="tooltip" data-placement="top" data-original-title="First name is mandatory"><i></i></span>
</div>
</div>
<!-- // Group END -->
<!-- Group -->
<div class="control-group">
<label class="control-label" for="phonenumber" >Phone Number:</label>
<div class="controls">
<input type="text" name="phonenumber" id="phonenumber" value="<?php echo $user_number; ?>" class="span10" />
</div>
</div>
<!-- // Group END -->
</div>
<!-- // Column END -->
</div>
<!-- // Row END -->
<div class="separator line bottom"></div>
<!-- Group -->
<div class="control-group row-fluid">
<label class="control-label" for="bio">About me</label>
<div class="controls">
<textarea id="bio" name="bio" class="span12" rows="5"><?php echo $user_bio;?></textarea>
</div>
</div>
<!-- Form actions -->
<div class="form-actions" style="margin: 0;">
<button type="submit" id="accountdetails" name="accountdetails" class="btn btn-icon btn-primary glyphicons circle_ok"><i></i>Save changes</button>
</div>
</div>
</form>
<!-- // Form actions END -->
dev.php
if (isset($_POST['accountdetails'])) {
if (isset($_POST['fname']) || isset($_POST['lname']) || isset($_POST['email']) || isset($_POST['phonenumber']) || isset($_POST['bio'])) {
die ("HERE");
};
};
I probably need to drink more Coffee but I cannot for the life of me work out why it is not working.
Any help would be appreciated!
Thanks in advance.
EDIT
I put the name's in and this did not help, now the URL of the page shows this:
update.php?fname=Aaron&lname=Hatton&email=me%40aaronhatton.co.uk&phonenumber=0123456789&bio=+18+%7C+London+%7C+Taken&accountdetails=
any ideas?
One: do what Fred said (name attributes on your input tags).
Two: You're missing the </form> tag at the end.
Your form page seems correct, however, since the form updates the user data, look what the dev.php code is doing:
isset() function returns true if the value is set and you manual set the fields so it will evaluate to true.
and in your if statement you are ORing all the conditions so as soon as it finds 1 true condition, it will go into the if statement body and execute die which will do nothing.
so if you want to test, instead of using die, try echo "here" to see if a message is printed.
So I found out the form works perfect and there was some AJAX being used by another coder, removed and surprise surprise it works perfectly!
Damn co-workers!
Thanks to all that helped!

codeigniter validation error with field "required"

i have a problem with the validation form. It does not work if i put "required", example:
controller:
public function updateBenefit(){
$result = array();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('beneficio', 'Nombre del Beneficio', 'required|alpha');
$this->form_validation->set_rules('info', 'Info', 'alpha');
$this->form_validation->set_rules('descrip', 'Descripción', 'alpha');
$this->form_validation->set_rules('orden', 'Orden', 'integer');
// $this->form_validation->set_rules('fecha', 'Fecha', 'date_valid');
$this->form_validation->set_message('required', 'El campo %s es requerido');
if ($this->form_validation->run() == TRUE){
if (isset($_POST['id'])){
$idb = $_POST['id'];
$benefit = BeneficiosManager::getInstance()->getHome($idb);
$result['message'] = "Se ha modificado el Beneficio con éxito";
} else{
$benefit = BeneficiosManager::getInstance()->create();
$result['message'] = "Se ha cargado el Beneficio con éxito";
}
$benefit->nombre = ucfirst(strtolower($_POST['beneficio']));
$benefit->content = ucfirst(strtolower($_POST['descrip']));
$benefit->intro = ucfirst(strtolower($_POST['info']));
$benefit->active = $_POST['optionsRadios2'];
$benefit->orden = $_POST['orden'];
// $benefit->date = $_POST['fecha'];
BeneficiosManager::getInstance()->save($benefit);
}else{
//no se validaron los datos ingresados
$result['message'] = "Error validación";
}
echo json_encode($result);
}
view:
{extends file='admin/base/base.tpl'}
{block name='content'}
<h3>Cargar Beneficio </h3>
</br>
<form action="{site_url()}admin/updateBenefit" class="form-horizontal" method="post" id="" enctype="multipart/form-data">
<div class="control-group">
<label class="control-label">Beneficio</label>
<div class="controls">
<input type="text" name="beneficio" value="" class="m-wrap medium" />
<span class="help-inline">Nombre del Beneficio</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Info</label>
<div class="controls">
<textarea name="info" class="medium m-wrap" rows="3"></textarea>
<span class="help-inline">Información Clave</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Descripción</label>
<div class="controls">
<textarea name="descrip" class="large m-wrap" rows="3"></textarea>
<span class="help-inline">Descripción del Beneficio</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Activo</label>
<div class="controls">
<label class="radio line">
<input type="radio" name="optionsRadios2" value="1"/>Si</input>
</label>
<label class="radio line">
<input type="radio" name="optionsRadios2" value="0"/>No</input>
</label>
<span class="help-inline">Ofrecer Beneficio</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Orden</label>
<div class="controls">
<input type="text" name="orden" value="" class="m-wrap small" />
<span class="help-inline">Prioridad del Beneficio</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Fecha</label>
<div class="controls">
<input type="text" name="fecha" value="{$smarty.now|date_format}" class="m-wrap medium" />
<span class="help-inline"></span>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn blue"><i class="icon-ok"></i> Guardar</button>
<button type="button" class="btn">Cancelar</button>
</div>
</form>
{/block}
what might the problem be?
if i remove the "required" field, the form validates... but if i put it, it doesn't... i don't know what else to try, can't understand why this is happening
the code is working now, thanks to #Jonathan that corrected me, and i was also making an imput mistake when i was trying this method. I was trying to put two words in the same field (i.e: bon vivir); so the correct input would be: bonvivir.
I'm not sure you are using "title" as the name of your real title input element. Because I found you use this code to assign your title.
$benefit->title = ucfirst(strtolower(trim($_POST['beneficio'])));
So you may want to try to use
$this->form_validation->set_rules('beneficio', 'Nombre del Beneficio', 'required|alpha');
instead.
I am not sure I had the right guess. Just give it a go. Hope this helps.

Categories