PHP Form Question (Again...)
Sorry for all these questions on PHP validations and such,
but I know you
all enjoy helping!
Anyway - I'm using this bit of PHP code to keep the user's
input inside the
textfields and textboxes when the page is refreshed due to
any errors being
on the page:
value="<?php if(isset($_POST['fieldname'])) echo
htmlentities($_POST['fieldname']);?>"
Or if it's inside a textarea, I just omit the value=" .
Is this possible to do with select boxes? Each time the page
reloads due to
any errors (not filling in all the fields) they all reset to
their default
(first option) and the user has to select them all over
again.
Thanks guys!
Shane H
[email protected]
http://www.avenuedesigners.com
On 5/1/06 11:16 PM, "Shane H" wrote:
> I've got 50 states to go through <lol> - isn't
there an easier way than
> entering them all into an array...?
Hmmm.... the snippet I posted a few days ago of my php state
select list
function will keep an element's SELECTED value. See the "if
(isset)" lines
down toward the end? Those check for the POSTed status of the
select element
and set the option to selected if it was originally selected.
function stateselectlist() {
$states = array('' => 'Please Select State', 'AL' =>
'Alabama', 'AK' =>
'Alaska', 'AZ' => 'Arizona', 'AR' => 'Arkansas', 'CA'
=> 'California',
'CO' => 'Colorado', 'CT' => 'Connecticut', 'DC' =>
'District of
Columbia', 'DE' => 'Delaware', 'FL' => 'Florida', 'GA'
=> 'Georgia', 'HI'
=> 'Hawaii', 'ID' => 'Idaho', 'IL' => 'Illinois',
'IN' => 'Indiana', 'IA'
=> 'Iowa', 'KS' => 'Kansas', 'KY' => 'Kentucky',
'LA' => 'Louisiana',
'ME' => 'Maine', 'MD' => 'Maryland', 'MA' =>
'Massachusetts', 'MI' =>
'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
'MO' =>
'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV'
=> 'Nevada', 'NH'
=> 'New Hampshire', 'NJ' => 'New Jersey', 'NM' =>
'New Mexico', 'NY' =>
'New York', 'NC' => 'North Carolina', 'ND' => 'North
Dakota', 'OH' =>
'Ohio', 'OK' => 'Oklahoma', 'OR' => 'Oregon', 'PA'
=> 'Pennsylvania', 'PR
'=> 'Puerto Rico', 'RI' => 'Rhode Island', 'SC' =>
'South Carolina', 'SD'
=> 'South Dakota', 'TN' => 'Tennessee', 'TX' =>
'Texas', 'UT' => 'Utah',
'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' =>
'Washington', 'WV' =>
'West Virginia', 'WI' => 'Wisconsin', 'WY' =>
'Wyoming');
$str = "<select name=\"state\" id=\"state\">\n";
foreach ($states as $key => $value) {
$str .= "<option value=\"$key\"";
if (isset($_POST['state']) && ($key ==
$_POST['state']) ) {
$str .= 'selected="selected"';
$str .= ">$value</option>\n";
$str .= "</select>\n";
return $str;
} // END function stateselectlist
Sonjay
Similar Messages
-
I've made several php forms that work perfectly. I used the NateMail php script.
For some reason this one http://bravocleaningmn.com/contact.html is not working.
Any help would be greatly appreciated!PHP is either not installed and running on the server, or it hasn't been enabled for your hosting account, from what I can tell.
-
I had this all working until I set the parameters for the
form to redirect to the thank you page. Now the checkbox won't
validate!
Help!
Here is the link
to the form> name="Agreed to Terms"
> type="checkbox" id="Agreed to Terms"
change the name/id to something without blank spaces.
"Agree_to_Terms"
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/ -
I am a new web designer who is not code savey yet. Anyway
during the various sites i have designed i have used 3 different
forms that process and email it to me using a seperate php form, 1
in flash, 2 from a standard html form on a windows server. All have
been uploaded, to the site, tested and worked fine. 2 are in old
sites, one in my current site. Recently all 3 forms stopped working
and while they looked like they worked fine they no longer actually
sent anything. I had a big email arguement with my host and finally
they added this line into my php script "ini_set
("sendmail_from","[email protected]");" email address is example here
and they added another form to my site called "php4-cgi-fcgi.ini."
Then my curent form started working again. I haven't changed
anything, and of course the host never informed me of any changes.
So why did this need to be added for my form to work again? Does
this mean they upgraded to another version or something? Ihad a big
arguement with them because they refused to tell me what they did
that stopped all my forms from working, they kept acting like it
was me or my provider that caused the problem, when i am positive
we were not the problem. Any thoughts?doing a google on "ini_set ("sendmail_from" gives a lot of
info.
summary- the form script you are using is probably not
setting a default
"FROM" email address, so the host has phpmail() reject it as
possible spam
abuse.
The .ini files the host added to your site correct the
problem. They change
values for php to use within your hosting domain.
What php script are you using to send the emails? It is
probably out of date
if it doesn't address this issue.
Off Topic: suggest never arguing with hosting support. Even
it the person at
the other end of the phone is an 18 year old drone not
earning their salt.
Move the site if needed. Develop social engineering skills to
get things
done.
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/ -
Need help with PHP form with checkboxes, radio buttons and file attachment
Hi guys,
I'm having a nightmare with this PHP form where a user can fill it in, attach a doc/pdf and submit. After trying to sort it out with previous code I've used, I've stripped it out and think I should just start again in the hope you geniuses can help!
Here is the HTML of contact.php:
<form action="" method="post" name="contact" id="contact">
<p>Job Title:*<br />
<input name="position" type="text" /></p>
<p>Nationality:*<br />
<select name="nationality">
<option value="">-- select one --</option>
<option value="Afghan">Afghan</option>
<option value="Albanian">Albanian</option>
<option value="Algerian">Algerian</option>
<option value="Zambian">Zambian</option>
<option value="Zimbabwean">Zimbabwean</option>
</select>
</p>
<p>Which country are you currently living in?*<br />
<select name="country">
<option value="">-- select one --</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Africa">Africa</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
</select>
</p>
<label class="radio" for="checkRight">Yes/No question?</label><br />
<input class="radio" type="radio" name="right" value="Yes" /> Yes
<input class="radio" type="radio" name="right" value="No" /> No
<input class="radio" type="radio" name="right" value="N/A" /> Not applicable
<p>Yes/No question?<br />
<select name="continue">
<option value="">-- select one --</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</p>
<p>Select your resorts:<br />
Resort 1<input name="res1" type="checkbox" value="Resort 1" />
Resort 2<input name="res2" type="checkbox" value="Resort 2" />
Resort 3<input name="res3" type="checkbox" value="Resort 3" />
Resort 4<input name="res4" type="checkbox" value="Resort 4" />
Resort 5<input name="res5" type="checkbox" value="Resort 5" />
Resort 6<input name="res6" type="checkbox" value="Resort 6" />
</p>
<p>Don't send form unless this is checked:* <input type="checkbox" name="parttime" value="Yes" /></p>
<p>Date of arrival: <input name="arrive" id="datepick" /><br />
Date of departure: <input name="depart" id="datepick2" /></p>
<script type="text/javascript" src="assets/scripts/datepickr/datepickr.js"></script>
<link href="assets/scripts/datepickr/datepickr.css" rel="stylesheet">
<script type="text/javascript">
new datepickr('datepick');
new datepickr('datepick2', {
</script>
<p>Name:*<br />
<input name="name" type="text" /></p>
<p>E-mail:*<br />
<input name="email" type="text" /></p>
<p>Telephone:*<br />
<input name="telephone" type="text" class="ctextField" /></p>
<p>Upload CV (Word of PDF formats only):<br />
<input type="file" name="cv" class="textfield"></p>
<p><input name="submit" value="Submit Enquiry" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
</form>
By the way, the date boxes work so excuse the Javascript in there!
To prevent SPAM I've used a trick where there's a hidden URL field which must be left blank for the form to submit which you can see in the PHP.
Below is where I'm at with the PHP which is placed above the header of contact.php...
<?php
if (array_key_exists('submit', $_POST)) {
$position = $_POST['position'];
$arrive = $_POST['arrive'];
$nationality = $_POST['nationality'];
$parttime = $_POST['parttime'];
$depart = $_POST['depart'];
$name = $_POST['name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$to = "[email protected]";
$subject = "Recruitment Application";
$message = $headers;
$message .= "Name: " . $_POST["name"] . "\r\n";
$message .= "E-mail: " . $_POST["email"] . "\r\n";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= 'From: My Website <[email protected]>' . "\r\n";
$message= "
$url = stripslashes($_POST["url"]);
if (!empty($url)) {
header( 'Location: http://www.go-away-spam-robots.com' );
exit();
if (!isset($warning)) {
mail($to, $subject, $message, $headers);
header( 'Location: http://www.mywebsite.co.uk/sent.php' );
?>
I would like to make pretty much all the field compulsory so if a field is left empty (other than the hidden URL field), a warning message is displayed next to that field.
Also I would like the file upload field to attach to the email that is sent to me and have the results come through to me in a table format.
Can anyone help me get my form working?
Thank you and I hope to hear from you!
SMHi Nancy,
Great stuff, thank you for the reply.
I've managed to get the Formm@iler working and running as I need it to.
The only thing I'm struggling with is when the user clicks submit, they are taken to a page of whatever results the form returned but it is just a white background with Times New Roman text.
How can I have it so the user is taken to the form results in the websites' page layout?
I tried sending them to a generic 'thank you' page by adding the following code but it just took them there whatever the results of the form so that's no good...! I have a feeling it's a bit more complicated than that...
header( 'Location: http://www.nofussbus.co.uk/test/sent.php' );
Thank you for your help! -
PHP Form Validation and Insert Records
Hi There,
I've been scratching my head for 2 days and couldn't find a solution.
Here is my problem:
Go to http://ecopethandbags.com/contactTest.php and click the "Send Comments" button.
You will see that the validation works.
Now, go to http://ecopethandbags.com/contactTestInsert.php, this time, I've inserted the "Insert Record" server behavior.
Click the "Send Comments" button again.
You will see the ugly message like "Column 'firstname' cannot be null" in a plain white page.
My question is:
How can I insert the PHP form records in my database and take advantage of the form validation nicely like in http://ecopethandbags.com/contactTest.php
I am attaching the files.
Thank you for you help!boloco wrote:
My question is:
How can I insert the PHP form records in my database and take advantage of the form validation nicely like in http://ecopethandbags.com/contactTest.php
Use simple PHP logic to merge the scripts together.
Dreamweaver automatically puts the Insert Record server behavior code at the top of the script. You need to adapt it so that the validation is done first. If the validation succeeds, use the Insert Record server behavior. If not, redisplay the form.
if (array_key_exists('send', $_POST)) {
// validate the form input
if (!$suspect && empty($missing)) {
// send the mail
if ($mailSent) {
unset($missing);
// insert the Insert Record server behavior code here -
Form question. It looks simple, but is it...?
I have this form:
The image says it all, how can I move the circled text up to align with the top of the comments box and use multiple lines of text there, instead of at the bottom as it currently is?
The form.php code is attached.http://www.millcon.nl/Harm/form.php
The whole page is here: http://ppbm5.com/submission.htmlBen,
Thanks again for your help.
First, some background on myself, so you know you have to take it easy...
My programming background is from the days of Basic, Fortran, Cobol, RPG and - my favorite - APL. I did program econometric and statistical applications, using adanced techniques like ARIMA (auto-regressive integrated moving average) models similar to Box-Jenkins approaches. I have never progressed from APL to other, more modern languages, like C++, Java and the like. Matt Iverson is still my example of how to create A Programming Language (APL).
My business (HR consultancy) nor my hobby, videography and video editing, required me to learn these new languages.
A couple of months ago I started with DW CS4, which I have as part of the MC, because I wanted to create, together with Bill Gehrke, a new website for benchmarking hardware setups, specific for Premiere Pro CS5. See: http://ppbm5.com . Next I did a similar thing for my daughter, see http://poffertjes.ch
One of the problems we encountered with the way we worked in the past was that people had to submit their data by filling out questions posed in a VB script. Some left out relevant deatils, others made typo's like 10,000 instead of 1,000 for disk capacity, others named their video card 470 Gtx while others named them GTX 470 and so on. This caused us a lot of hard work and time to safeguard consistency in the Excel spreadsheet that we publish on the http://ppbm5.com/Benchmark5.html page.
With that in mind, I used a form maker to generate the php files to ease the burden a bit. See: PHP Form Mail Maker - A free tool to create ready-to-use web mail forms with customized auto response email | F.A.Q about PHP FormMail Generator
Now, the info I have given was not complete, in the sense that this form generator gives you three files in a ZIP file:
1. form.php, which is the layout of the form
2. form.lib.php which is used for the auto-response mail, and
3. admin.php for maintenance of the form and downloading CSV data from the forms submitted.
(I have sent these to you by PM, because of privacy considerations)
Your suggestions make a lot of sense. However, stupid noob that I am, I don't know where to paste your #php formatting statements. I deleted the OL class line and pasted your formats, but that is obviously not the way to go about is. Second problem I have is that the error correction on required fields no longer shows up correctly. Third issue is that in IE the form looks reasonably OK, the space between the comments box is slightly larger than the rest of the text, but FF leaves no space between them.
If you ever have a question about Premiere Pro or hardware, I may be able to help you, but here I'm lost.
PS. An autodidact is someone who had an idiot as a teacher. That applies to me. -
Hi all, I have a basic php form on a page, it works great,
and my email recieves the content as required, BUT, when the form
submits and the page shows the forms content, it throws out my
layout ocmpletely. My white maincontent dissapears, and the footer
div is all misaligned, my code is attached. Can anyone help please?
many thanksOn Thu, 7 Feb 2008 16:34:22 +0000 (UTC), "simbull"
<[email protected]> wrote:
>Thanks for the response gary, I have tried that (and just
did again), that
>means the user is not presented with the php output,
which I do want them to be
>ideally. Anyhow, that aside, it still throws my layout
out..?
Impossible to give you a better answer without knowing what
you want to
accomplish, but it sounds like your layout might be too
fragile.
Gary -
Need to add senders email address into the subject header of my PHP form (somehow)
Hello one and all,
I have a PHP form which is working fine and sends our support team an email with the subject header 'Support'.
I have been asked to fix this form to include the senders email address into the Subject header so that the support team can filter them easier and reply quicker.
Any help would be very much appreciated indeed. The form code is below, let me know if you need the whole page.
Thanks in advance,
Bradley
My current form PHP part looks like this: (and the HTML part is below in blue)
<?php
if($_GET["action"] == "email")
$msg = "The following person need support:\n\n";
$msg = $msg . "First Name: " . $_POST["FirstName"] . " " . $_POST["LastName"] . "\n";
$msg = $msg . "Tel: " . $_POST["Tel"] . "\n";
$msg = $msg . "Email: " . $_POST["FROM"] . "\n";
$msg = $msg . "Support: " . $_POST["Support"] . "\n";
$msg = $msg . "Model: " . $_POST["Model"] . "\n";
$msg = $msg . "Comments: " . $_POST["Comments"] . "\n";
$to ="[email protected]";
$subject = "Support";
$from = "From: " . $_POST["FROM"];
mail($to, $subject, $msg, $emailFrom, $from);
header("Location:support2.php");
?>
and the HTML part of the fom is like this:
<form id="form1" name="form1" method="post" action="support.php?action=email">
<table width="700" border="0" cellspacing="10" cellpadding="10">
<tr>
<td valign="middle" class="formtext">*First name:</td>
<td width="455" valign="middle"><label>
<input name="FirstName" type="text" class="form-textbox" id="FirstName" />
</label></td>
</tr>
<tr>
<td valign="middle" class="formtext">*Last name:</td>
<td valign="middle"><input name="LastName" type="text" class="form-textbox" id="LastName" /></td>
</tr>
<tr>
<td valign="middle" class="formtext">*Email:</td>
<td valign="middle"><input name="FROM" type="text" class="form-textbox" id="FROM" /></td>
</tr>
<tr>
<td valign="middle" class="formtext">*Telephone:</td>
<td valign="middle"><input name="Tel" type="text" class="form-textbox" id="Tel" /></td>
</tr>
<tr>
<td valign="middle" class="formtext"> </td>
<td valign="middle"> </td>
</tr>
<tr>
<td valign="middle" class="formtext">*Support required:</td>
<td valign="middle"><label>
<select name="Support" class="form-dropdown" id="Support">
<option selected="selected">Please select...</option>
<option value="Connection Issues">Connection Issues</option>
<option value="Technical Issues">Technical Issues</option>
<option value="Furniture Faults">Furniture Faults</option>
<option value="Other">Other</option>
</select>
</label></td>
</tr>
<tr>
<td valign="middle" class="formtext">Chair model:</td>
<td valign="middle"><input name="Model" type="text" class="form-textbox" id="Model" /></td>
</tr>
<tr>
<td valign="middle" class="formtext">*Please describe your issue:</td>
<td valign="middle"><textarea name="Comments" rows="5" class="form-textarea" id="Comments"></textarea></td>
</tr>
<tr>
<td valign="middle" class="maintext"> </td>
<td valign="middle" class="maintext"></td>
</tr>
<tr>
<td valign="middle"> </td>
<td valign="middle"><label>
<input name="Submit" type="submit" class="form-submit-button" value="Submit" />
</label></td>
</tr>
</table>
</form>MurraySummers you sir, are an absolute legend! This worked perfect straight off the bat!
I really apreciate your lightning fast reply!
Thanks again.
Bradley -
i have been lately having trouble with a php form. it will not send the form out to me when they submit it. is there something wrong with the coding? it works for me.
future-architect wrote:
Is there anybody here that knows how to do php coding?
Yes, but you should post questions about PHP in the right forum: Dreamweaver Application Development. Also, don't just keep adding new questions to an old thread. Everything might seem related to you, but other people see a thread that has already received a lot of replies, and are likely to skip it unless they have already been involved. Take a look at this post about how to get help quickly. -
PHP Form Redirect without Header function
I need help with a PHP form that needs to redirect to a thankyou page upon sending. I have tried the header function but it doesnt work because i have multiple PHP references throughout the page that prevent the header function from working. Is there another way to redirect once the email sends? I am leaving out the rest of the form and functions but this is what i have currently that affects the message sending:
In form page requestquote.php:
<? include('sendemail.php'); if($cmsg) echo"<h1>".$cmsg."</h1>"; else { ?>
In sendemail.php:
mail($recipient, $subject, $formcontent, $mailheader) or die("There was an error in your request. Please go back and try again.");
$cmsg="Thank for you requesting a quote. A Blue Grace Representative will contact you shortly." ;
Thanks,
BenI need the thankyou page for conversion tracking on the website, which cant be done with a simple message. Thats what i have currently in the form.
If i put the code in the form action area, will it redirect only upon sending? I want to make sure it goes through the process of validating all the fields and sending the email before it redirects.
Thanks,
Ben -
Hi,
I've found a PHP form handler in one of the forums to process my feedback page. All works well but one thing I can't work out is when a visitor to the site fills in the info and clicks the submit button, that comes back to my mail box as expected but if I want to reply to this email the site's email address always comes up in the "To" field rather than the viewer's email address, is there anyway to change this? I've trawled the forums but can't find an answer, have included the php code if anyone has any suggestions.
Thanks in advance.
<?php
if (!empty($HTTP_GET_VARS)) while(list($name, $value) =
each($HTTP_GET_VARS)) $$name = $value;
if (!empty($HTTP_POST_VARS)) while(list($name, $value) =
each($HTTP_POST_VARS)) $$name = $value;
$contact_msg="Dear $contact,
Thank you for taking the time to contact My Comany via our web site.
Your request has been received and will contact you ASAP.
Regards
My Company
http://www.mycompany.co.nz
mailto:[email protected]
mail("$eMail","Contact Form","$contact_msg","From: My Company <[email protected]>");
$contact_copy="
------------ My Company request information form --------------
The following person has filled out the contact form:
-- CUSTOMER DETAILS
First Name: $contact
Last Name address: $lastName
Company: $company_Name
Phone Number: $phone_Number
email: $eMail
Questions: $questions
-- !END OF FORM --------------------------------------------
mail("[email protected]","Contact Form","$contact_copy","From: My Company <[email protected]>");
?>Thanks for posting this useful information. I found some more at php tutorial.
-
Hi. I've got php form from one of the templates but it doesn't work. Can anyone see an error?
The code:
<div id="content_item">
<h1>Contact Us</h1>
<p>Say hello, using this contact form.</p>
<?php
// Set-up these 3 parameters
// 1. Enter the email address you would like the enquiry sent to
// 2. Enter the subject of the email you will receive, when someone contacts you
// 3. Enter the text that you would like the user to see once they submit the contact form
$to = [email protected];
$subject = Enquiry from the website;
$contact_submitted = Your message has been sent.;
// Do not amend anything below here, unless you know PHP
function email_is_valid($email) {
return preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',$email);
if (!email_is_valid($to)) {
echo '<p style="color: red;">You must set-up a valid (to) email address before this contact page will work.</p>';
if (isset($_POST['contact_submitted'])) {
$return = "\r";
$youremail = trim(htmlspecialchars($_POST['your_email']));
$yourname = stripslashes(strip_tags($_POST['your_name']));
$yourmessage = stripslashes(strip_tags($_POST['your_message']));
$contact_name = "Name: ".$yourname;
$message_text = "Message: ".$yourmessage;
$user_answer = trim(htmlspecialchars($_POST['user_answer']));
$answer = trim(htmlspecialchars($_POST['answer']));
$message = $contact_name . $return . $message_text;
$headers = "From: ".$youremail;
if (email_is_valid($youremail) && !eregi("\r",$youremail) && !eregi("\n",$youremail) && $yourname != "" && $yourmessage != "" && substr(md5($user_answer),5,10) === $answer) {
mail($to,$subject,$message,$headers);
$yourname = '';
$youremail = '';
$yourmessage = '';
echo '<p style="color: blue;">'.$contact_submitted.'</p>';
else echo '<p style="color: red;">Please enter your name, a valid email address, your message and the answer to the simple maths question before sending your message.</p>';
$number_1 = rand(1, 9);
$number_2 = rand(1, 9);
$answer = substr(md5($number_1+$number_2),5,10);
?>
<form id="contact" action="contact.php" method="post">
<div class="form_settings">
<p><span>Name</span><input class="contact" type="text" name="your_name" value="<?php echo $yourname; ?>" /></p>
<p><span>Email Address</span><input class="contact" type="text" name="your_email" value="<?php echo $youremail; ?>" /></p>
<p><span>Message</span><textarea class="contact textarea" rows="5" cols="50" name="your_message"><?php echo $yourmessage; ?></textarea></p>
<p style="line-height: 1.7em;">To help prevent spam, please enter the answer to this question:</p>
<p><span><?php echo $number_1; ?> + <?php echo $number_2; ?> = ?</span><input type="text" name="user_answer" /><input type="hidden" name="answer" value="<?php echo $answer; ?>" /></p>
<p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="contact_submitted" value="send" /></p>
</div>
</form>
</div>The only error I see is your text strings which are assigned to the php variables should be enclosed in " " like below: (best not to post real email addresses as it attracts spam)
$to = "[email protected]";
$subject = "Enquiry from the website";
$contact_submitted = "Your message has been sent.";
Plus change the $return variable to a line break (as below) otherwise the information will come through in one continuous line.
$return = "\n\n"; -
PHP Form Validation and Radio Group
Hi David,
I'm trying to set the initial state of a radio group to none.
Please look at the file http://ecopethandbags.com/contact.php. The initial state is set to "No"
In Dreamweaver, I've set the initial state to "Unchecked"
I don't understand the code for the radio buttons in my file (see attachment).
What I am trying to do is to have the radio group initially unchecked but required.
I have 2 questions:
1) - How can I control the initial status of the radio group when I use the PHP form validation?
2) - How can I set the validation so, when one of the radio buttons is not checked by the user, a warning flag like "Please make a choice" comes up.
Thank you much!Just change the following section of code:
<?php
if (!$_POST || isset($missing) && $_POST['subscribe'] == 'n') {
echo 'checked="checked"';
} ?>
Remove the !$_POST || like this:
<?php
if (isset($missing) && $_POST['subscribe'] == 'n') {
echo 'checked="checked"';
} ?>
The checked="checked" will be inserted into the code only if the form has been submitted, but neither radio button has been selected. -
Insert PHP-form into XHTML-div
Maybe a noobish question but i cannot find the solution on the web...
I have a XHTML based index.html.
I use Spry tabbed panels.
In 1 Panel (Contact Panel) i like to have a email form displayed.
How do i show my Form.php inside this div?
I want the Content div to display the php form without putting the php code in the div.
Header
Menu
Content [here do i want to display the form]
FooterBest to use an external PHP page and link the form to it. Something like:
<form action="php/sendform.php" method="post" name="contactForm" id="contactForm">
Then lay the form out the way you want in the DIV.
Maybe you are looking for
-
How to make a business card? -Adobe Illustrator CC
Hello, I'm really stressed after searching the web for a tutorial on how to create a business card in Adobe Illustrator CC. I already have the graphics done, but I just need to know the dimensions and what unit it is. I'm using a homemade kit for the
-
Approval hierarchies in INV: Move Order transactions
Greetings! The Inventory user requires APPROVAL Hierarchy in Mover Order Request form, same like Purchase Order and Requisition has in PO module. Is this possible in Inventory, with / without any Customizations? -- GT
-
I've been working on a portfolio website for my girlfriend this past week, and even in iWeb its proving to be pretty tough. I've created a photo album for the site. However, when I publish and then view the published site, no album appears. Is there
-
How to create custom service name in oracle 10g
Hi, I have installed oracle 10g, it has created default servicename as XE which is having only 4GB memory size. It is not sufficient to import my dmp file. I would like to created my own service name, How can I do it. Advice thanks for your instructi
-
Hi Friends, I have an XML file.Is there any FM available to convert that into .txt file? Regards