Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

using long sentences in form

Featured Replies

i currently have a few form elements that will need long name elements

 

<label for="Reducing your fee whilst we build your account means we can finish what we have started and you pay less. Once we finish the build you may wish to up the phrases again after you have seen the positive results. Is this of interest?" class="name">Reducing your fee ( phrases) whilst we build your account means we can finish what we have started and you pay less. Once we finish the build you may wish to up the  again after you have seen the positive results. Is this of interest?</label>
             <input type="checkbox" name="Reducing your fee whilst we build your account means we can finish what we have started and you pay less. Once we finish the build you may wish to up the phrases again after you have seen the positive results. Is this of interest?" id="" class="required"  value="yes"/>yes
              <input type="checkbox" name="Reducing your fee  whilst we build your account means we can finish what we have started and you pay less. Once we finish the build you may wish to up the phrases again after you have seen the positive results. Is this of interest?" id="" class="required"  value="no"/>no

 

how would i go about posting the name element in php or is there ristriction on word/letter lenth in forms cannot seem to get it to post

Why do they need long name elements? That won't work as the name attribute is not meant for holding content. You use the name to reference it from JS/server side when the form is posted.

 

You'd have something like:

<input name="newsletter" type="checkbox" id="newsletter_check" />
<label for="newsletter_check">Really long sentence about how you should tick this bloody box yo</label>

 

Where the label for="" references the id of the form element.

 

edit: I should've read your profile before commenting :D - there's probably a reason you want to do this - though whatever it is, I cannot imagine. Good luck!

Edited by henbast

  • Author

Would you be able to expand on why you need the long name elements at all?

the client needs the full questions posting to his team

Are you not able to use names like...

 


<?php

if (isset($_POST['question1'])) { $question1 = "Really long sentence about how you should tick this bloody box yo"; }

?>

<input name="question1" value="yes" type="checkbox" />

 

Would that work for you?

 

Then you can just echo the variable $question1 or am I missing something important here?

Edited by EpicWebs

  • Author

i have this code in my sendmail.php file

$extras = '';
foreach ($_POST as $key => $field) {

if(!in_array($key,$currently_active)) {
	$extras.= $key . ": " . $field . "<br /> \n";
}

}

 

If i add any fields manually to contact form, this grabs them and send them in the email also this form has no page refresh

Is it dynamic or do you know what the element names are going to be every time?

 

I am wondering if you can use an if statement to check what the current field is and if it is question1 then add a certain sentence to $extras.

 


if($field == "question1") { $extras.= $key . ": really long sentence that you already know <br /> \n"; }

 

Let me know if I am not helping lol.

 

Good luck!

  • Author

any help is really appriciated everything was fine until they asked me to add extra fields with super long questions

Can you stick the questions into an array maybe?

 

$questions = array(
'beans' => 'Do you like beans?',
'hedges' => 'Can you trim hedges?'
'dinner' => 'Something really long about what you would like for dinner?'
);

 

Then in HTML:

<?=$questions['beans']?> <input type="checkbox" value="yes" name="beans" />

 

Then finally in your form script:

$extras = '';
foreach ($_POST as $key => $field) {
 if (array_key_exists($key, $questions)) {
$long_key = $questions[$key];
 } else {
     $long_key = $key;
 }

       if(!in_array($key,$currently_active)) {
               $extras.= $long_key . ": " . $field . "<br /> \n";
       }

}

Edited by henbast

or stick them in a file or database and then call them in as and when they are needed. Then you won't have to keep updating the page.

  • Author

seems like it is being ristricted to certain number of characters

You should really use PHP to push out the long sentences, this way you can pass a form element and value to identify which question was raised. Then it will compare it and return the long version.

There are some examples above which illustrate this quite well.

  • Author

thanks for the advice will make a start on this :yahoo: :yahoo:

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.