Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
My plan is to automatically create checkboxes with names and random values for example a hundred in a for loop. Is there any way to do this?
And if i want to use these how to change the value and save it to the array?
in php
<?php
for($i=0;$i<100;$i++){
echo '<input type="checkbox">';
}
//if you want to add a submit btn at last
echo '<input type="submit" value="Submit">';
?>
It is the code to automatically create 100 checkboxes
And put your own values and styles
Related
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 1 year ago.
Improve this question
I did create a Html form tag and Html button tag.
Now I want to create again form tag when the user clicks my button
I think this is possible with JavaScript
If anyone knows please help me
Thanks
Here is a sample code. This will add the form once.
let form = document.getElementsByClassName('sample-form')[0]
//make copy of the original form using cloneNode(true). true means JS will copy all the nodes inside of the form element. It's called "deep copy".
function duplicateForm(){
return form.cloneNode(true);
}
let addForm = document.getElementById('add-form')
addForm.addEventListener('click', function(){
document.body.append(duplicateForm())
})
<form class="sample-form">
<input placeholder="Your value here"/>
</form>
<button id="add-form">Add New Form</button>
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 1 year ago.
Improve this question
enter image description here
1)Make up the design below
2)License type output in Bebas font-output via font-face
3)Display the selected license type and total amount
4)The format of the link in the Buy Now button is formed at your discretion
(How to execute an item highlighted in italics)
You need to have an HTML element (like a paragraph) where you want to display the amount.
If you give the element an id attribute with the value "my-paragraph", then your script can get the element like myParagraph = document.getElementById("my-paragraph").
Then you can change the content of the element like myParagraph.textContent = myAmount.
Begin your learning journey on MDN: https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
On a php page I will show the records of table. Then I want to delete the selected rows by checkboxes by clicking the button. How do I do that?
You can simply make with POST method also
Just set the id of row (retreive from database) as value of checkbox.
<input type="checkbox" name="chk[]" value=<?php echo $id;?> " >
and then hit the DELETE button.
On POST page you will get the ID of checked record.
Get all ID and combine all ID with implode function
$chkIds = $_POST["chk"];
$allIds = implode("','",$chkIds);
run the SQL query like :-
"DELETE FROM tablename WHERE id IN ('$allIds')"
you should pass your selected data id to your server;
FE: ajax -> send data to SERVER:php -> DATABAST:mysql run sql delete from table where xxx
So you should try learn about ajax and php pdo
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a simple HTML where you can click images. These images, whence clicked will moved to the Top Nav bar, I have IDs from this images and able to get each of them using jquery/javascript. I have this IDs set to an array variable.
My questions, is there a way to pass this to the Form then I issue a Submit so I can process the arrays. It is a 1D array with just IDs.
You can use hidden inputs:
<input type="hidden" name="image_ids[]" value="1">
<input type="hidden" name="image_ids[]" value="2">
<input type="hidden" name="image_ids[]" value="3">
Just create a new hidden input for each image id, with the same name image_ids[].
Note that when you append [] to the name of various input fields, these values are submitted as an array, in this case named image_ids.
Another solution is just to concatenate all the IDs with a comma: "1,2,3,4,5" and send it in just one hidden input field (instead of a bunch of hidden input fields), then in your server script (assuming you're using PHP) you can convert the string "1,2,3,4,5" to an array using something like: $image_ids = explode(',', $_POST['image_ids']);.
Good look.
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 9 years ago.
Improve this question
I need to add in all the textbox manually in my project.
<form>
<?php for($i=0;$i<3;$i++){ ?>
<input type="text" name="product[]">
<?php } ?>
</form>
how can i solve this problem so that the number of product for insert can be flexible.
For example, user1 need to purchase 4 item, user2 wan to purchase 8 item. wihtout dynamic textbox, i need to add the textbox manually by adjusting the looping value (in my coding).
It sounds like this is an update to customer products right?
if so, you probably have products array somewhere.
so you might do :
$products = $customer->products ;//or your array
for($i=0;$i<count($products);$i++){
// your code
}
or you can add it via javascript (sounds more like it if this is the purchase moment - new products, not update)
or you might want to have somewhere a config per customer.
or Please be more specific and more descriptive