How to Make Checkboxes Into Array In Dreamweaver [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
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
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I am designing a seat reservation system. I want the check boxes to represent the seats.
I want to know how to make each check boxes into array and how to group all the check boxes in a single canvas so that it will store multiple values in one single variable in the database column.
I am using Dreamweaver and PHP.

You should do some like below:
<input type="checkbok" value="1" name="seat[]" />
<input type="checkbok" value="2" name="seat[]" />
<input type="checkbok" value="3" name="seat[]" />
<input type="checkbok" value="4" name="seat[]" />
....

Related

Add <sup> in PHP not working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
I am editing a wordpress page and I am required to put square meter simbol m2 into a textbox. However I've been at it for an hour or more and I cannot get it to work. Php errors range from syntax error to T_ENCLOSED_STRING.
The Min Area (m2) is the text I want to edit.
The code:
<input type="text" class="field" name="area-min" id="area-min"
placeholder="<?php _e('Min Area (in m2)','realspace'); ?>"
value="<?php echo $_GET['area-min']; ?>" />
You can't put HTML in a placeholder. What you want is the special character ² which is ²
e.g.
_e('Min Area (in M²)','realspace')
You can't put HTML tag in inputs. But, you can use superscript characters:
<input type="text" class="field" name="area-min" id="area-min"
placeholder="Min Area (in m²)"
value="<?php echo $_GET['area-min']; ?>" />
Here, I'm using the ² character.
See also: Superscript in input field of text type

Starting a PHP Session from HTML log in form [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
what I want to do is start a php session for the username, right after the form so it brings up the username once the user has pressed submit.
Here's the code for the form I have:
<form name="login" method="post">
<input type="text" name="username" placeholder="Username"/>
<input type="submit" name="login" value="Login" />
</form>
What do I do after that? Thanks.
Here is a simplified way; put this on top of the page (above) the html code:
if (isset($_POST['login']) {
session_start();
$_SESSION['name'] = $_POST['name'];
}
Now use that new Session variable where you need as the username. If you close your browser. It's no longer stored. (Unless you set a cookie.)

how to show the hidden data from mysql database [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
<form name="form11" method="post" action="hpdata.php" enc type="multipart/form-data">
<input name="pro" id="pro" type="hidden" value= "CMS" />
<input name="piror" id="piror" type="hidden" value= "P1" />
<input name="stat" id="stat" type="hidden" value= "In Progress" />
<input type="submit" name="submit" id="submit" class="groovy button" value="...">
</form>
in this code I can't see the data
hidden attribute just use for hide item from the UI. but still you can acsess them after form is submitted using $_POST['id here'] (if form method is get you should get it through $_GET[])
the code you provided has nothing to do with mysql.
It is a html fragment. It contains hidden inputs. If you want to make them visible remove type="hidden".
But most likely there is a purpose why they are hidden. Often this is done to keep values for different form pages or to present the user with pretty values, but send easier to handle versions to the server. (e.g. dates can have different formats in different countrys, but its easier to just send them in a standardized form --> this one would be in a hidden input.)

Dynamic php submit [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
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
Improve this question
I have a php form with dynamic checkboxes. It must connect to sql server and get their count and names. At the end I want submit the checked boxes.
example
I get from db some vegetables, for a receipt, and add checkboxes in my form. The user will check some of the and submit it.
I can't make <input type=checkbox id=...> because when post it i will not know the names of them. For that reason, i made a js function and when a checkbox checked, i add it to a array.
Now i want ask you, how i can submit this array and after that get the values at post.php file?
Create your checkboxes like:
<input type="checkbox" name="veg[]" value="tomato">
<input type="checkbox" name="veg[]" value="lettuce">
<input type="checkbox" name="veg[]" value="carrot">
<input type="checkbox" name="veg[]" value="celery">
Even if you don't know the names, you can iterate through the checkbox using:
<?PHP
foreach($_POST["veg"] as $veg){
echo $veg;
}
?>
Have you added name attributes to your checkboxes? Like so:
<input type="checkbox" name="potatoes" />

PHP code to find an IP location from the IP entered through a input 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 need to make a custom code which will help me to find location of a particular IP entered through a text box.
When I searched the internet what I found is only providing automatic detection of IP and it's location. Please help me.
I am using this code in my website
Please try it yourself -
<?php
function countryCityFromIP($ipAddr)
{
$url = "http://api.ipinfodb.com/v3/ip-city/?key=5cfaab6c5af420b7b0f88d289571b990763e37b66761b2f053246f9db07ca913&ip=$ipAddr&format=json";
$d = file_get_contents($url);
return json_decode($d , true);
}
if(isset($_REQUEST['submit'])){
$ip=countryCityFromIP($_REQUEST['ip']);
//print_r($ip);
echo $ip['cityName'];
}
?>
<form method="post">
<input type="text" name="ip" />
<input type="submit" name="submit" value="Find" />
</form>
please use print_r($ip); to get the details which parameter will get from the url.
Take a look at the MaxMind GeoIP database. A tutorial for that one can be found at http://www.phpandstuff.com/articles/geoip-country-lookup-with-php. There are various other databases available as well. For that take a look at https://stackoverflow.com/search?q=geolocation+%5Bphp%5D

Categories