Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
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.
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 have 4 inputs as such
<input type="radio" class="radio" name="newsletter_to[]" value="newsletter_to_1" />
<input type="radio" class="radio" name="newsletter_to[]" value="newsletter_to_2" />
<input type="radio" class="radio" name="newsletter_to[]" value="newsletter_to_3" />
<input type="radio" class="radio" name="newsletter_to[]" value="newsletter_to_4" />
when the first any of the 3 first are checked, I can't get it back in my $_POST variable
How can it be ?
The HTML looks fine and should work as intended.
As you told me in the comments that you're using JavaScript to dynamically generate the form, double check the script to make sure that it is not interrupting the form submission in any way.
Tell me if you got it working. Else we'll try to further investigate :-)
Good luck.
It's radio buttons. Not checkboxes. You need to use type="checkbox" or all names change to 'newsletter_to'.
Can you show your $_POST?
<input type="checkbox" class="checkbox" name="newsletter_to[]" value="newsletter_to_1" />
<input type="checkbox" class="checkbox" name="newsletter_to[]" value="newsletter_to_2" />
<input type="checkbox" class="checkbox" name="newsletter_to[]" value="newsletter_to_3" />
<input type="checkbox" class="checkbox" name="newsletter_to[]" value="newsletter_to_4" />
<?php
$NewsLetter_to=$_POST["newletter_to"]
?>
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
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.
Closed 4 years ago.
Improve this question
The below code should echo when a user clicks on "more". I can't see the issue with the below code, so any assistance will be much appreciated.
if (isset($_POST['more'])){
echo <<<saveNewFactor
<input type="text" size="29">
saveNewFactor;
}
echo <<<saveNewFactor
</br>
<input type="submit" neme="more" value="more" class="forming7">
saveNewFactor;
In your HTML:
<input type="submit" neme="more" value="more" class="forming7">
You have spelt name as neme, change it to:
<input type="submit" name="more" value="more" class="forming7">
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 4 years ago.
Improve this question
I'm wondering how can I make checkbox image with html that I can send it with php to email. Or how can I target that image in checkbox with php?
I want that to be like small shop, that you can click on image and send it to email and ask for price.
Here is my tiny code:
<form>
<label>
<img src="https://upload.wikimedia.org/wikipedia/hr/thumb/5/55/Avatar_2009.jpg/220px-Avatar_2009.jpg">
<input type="checkbox" id="box">
</label>
<input type="submit" value="ask for price">
</form>
You can create another label and use for
TRY THIS:
<form>
<label for="box">
<input type="checkbox" id="box">
<img src="https://upload.wikimedia.org/wikipedia/hr/thumb/5/55/Avatar_2009.jpg/220px-Avatar_2009.jpg">
</label>
<input type="submit" value="ask for price">
</form>
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 7 years ago.
Improve this question
this is my first question!
I'm working on a simple email spoofer, but the problem is, when you click the submit button, the form fields save the originally entered values, and that means you can spam someone with tons of the same email easily by either pressing the submit button a lot or refreshing the page.
I would like some assistance.
Index.php - http://pastebin.com/dWp5V9vW
Mail.php - http://pastebin.com/DdZs8Rhq
That's because you're dropping the submitted field data into the HTML elements using PHP.
Here is the form HTML without the PHP extras.
<form action="index.php" method="POST">
<input type="text" name="from" placeholder="From" value="">
<input type="text" name="to" placeholder="To" value="">
<input type="text" name="subject" placeholder="Subject" value="">
<textarea name="body"></textarea>
<input type="submit" name="submit" value="Sent">
</form>
Just replace it in your index.php file.
Edit: If you're feeling a bit lazy, I did it for you: http://pastebin.com/XDZyva5T
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I have the following code, which is at the end of a form, and asks visitors if they would like to sign up for a newsletter. Currently the checkbox is checked by default, but I would like to change it so it is UNchecked by default. I have tried changing it to checked="unchecked", but it's not working. I am a newbie, so please be detailed - and patient! Thank you!
<p>
<label for="newsletter" style="width: 53%;margin-left: 120px;">
<input type="checkbox" name="cd_request[newsletter]" value="1" checked="checked" id="newsletter">
I would like to receive email updates
</label>
</p>
You simply remove the checked attribute completely.
Like:
<input type="checkbox" name="cd_request[newsletter]" value="1" id="newsletter">
and your full code would look like this:
<p>
<label for="newsletter" style="width: 53%;margin-left: 120px;">
<input type="checkbox" name="cd_request[newsletter]" value="1" id="newsletter">
I would like to receive email updates
</label>
</p>
You can get a better understanding of the <input> element from here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#Attributes
You'll notice the checked attribute also does not need to say checked="checked" it can simply be checked.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
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.
Closed 8 years ago.
Improve this question
im trying to pass a variable with a submit button and it doesn't work.
<FORM METHOD="LINK" ACTION=<?php echo "\"add_event.php?email=".$email."\""?>>
<INPUT TYPE="submit" VALUE="add event">
</FORM>
$email is fine in the page that's calling it.
http://localhost/aproject/add_event.php?
that is the url that's passed.
not
http://localhost/aproject/add_event.php?email=myemail#email.com
as I want.
Any thoughts are appreciated.
edit:
the generated html is
<form method="LINK" action="add_event.php?email=closeded#gmail.com">
<input type="submit" value="add event">
</form>
There is no such form method as LINK, so your form is using GET (the default).
When you submit a GET form, you will destroy any existing query string on the form action and replace it with one generated from the form data.
Use a hidden input to store your data instead.
<form action="add_event.php">
<input type="hidden" name="email" value="<?php echo htmlspecialchars($email); ?>">
<input type="submit" VALUE="add event">
</form>