|
||||||
| PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi all,
First request for help from a programming newbie. I want to collect information from a form to be included in a text message and send it with phpmailer. Nevertheless, I canīt figure out how to include dynamic information if a condition has been meet. In my case, when a user fills the form checkboxes, I want to include inside the standard message a text according to the choices the user has made. How is it possible to use loops such as "foreach" or "if" to create this content to be inserted inside the standard message? |
| Sponsored Links |
|
|
|
|||||
|
Are you using checkboxes for a condition? Users can select multiple checkboxes but here is how to find the value.
HTML Example: HTML Code:
<input type="radio" value="Female" name="gender">
PHP Code:
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages! |
|
|||
|
The idea is to create a text according to the chekcboxes checked, not to print their value.
I want to create the text included in the body of the message sent by phpmailer, something like: $mail->Body = "Thank you. We have received you info Mister".$name." -- here i want to print a message according to the value of one or more checkboxes (conditional loop) --"; |
|
|||
|
Is incredible what one night sleep helps (and of course some thinking)
![]() My solution was: $text=$text.$loopresult."\n"; and place the result in the text body. Why things seems so complicated in the first instance ? Just some newbie excitment ![]() |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 97%