close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

binding select list populated dynamically First Name Last Name

Thread began 2/02/2015 7:24 am by JBWebWorks | Last modified 2/03/2015 9:10 am by JBWebWorks | 3043 views | 9 replies

JBWebWorks

Put this at top of page
<?php

if($_SERVER["REQUEST_METHOD"] == "POST") {

foreach($_POST as $key => $val) {

if(is_array($_POST[$key])) $_POST[$key] = implode(", ", $_POST[$key]);

}

}

?>

Put this before the form
<?php $selected = explode(", ", ValidatedField("index_500","player1")); ?>

and this is the form
<form id="form1" name="form1" method="post" action="">

<label for="player1"><strong>Your Name:</strong></label>
<select name="player1[]" id="player1">
<option value="" selected="selected">Select From Dropdown</option>
<?php
do {
?>
<option value="<?php echo $row_rs_members['First Name']?> <?php echo $row_rs_members['Last Name']?>" <?php if(in_array($row_rs_members['First Name'], $selected)) echo("selected=\"selected\""); ?>><?php echo $row_rs_members['First Name']?> <?php echo $row_rs_members['Last Name']?></option>
<?php
} while ($row_rs_members = mysql_fetch_assoc($rs_members));
$rows = mysql_num_rows($rs_members);
if($rows > 0) {
mysql_data_seek($rs_members, 0);
$row_rs_members = mysql_fetch_assoc($rs_members);
}
?>
</select>
<?php
if (ValidatedField('index_500','index_500')) {
if ((strpos((",".ValidatedField("index_500","index_500").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<span class="stylered">Name required</span>
<?php //WAFV_Conditional index.php index_500(1:)
}
}
}?>
<br />
<br />
<label for="tee1"><strong>Your Tee Choice:</strong></label>
<select name="tee1" id="tee1">
<option value="" selected="selected" <?php if (!(strcmp("", (ValidatedField("index_500","tee1"))))) {echo "selected=\"selected\"";} ?>>Select Your Tee</option>
<option value="Gold" <?php if (!(strcmp("Gold", (ValidatedField("index_500","tee1"))))) {echo "selected=\"selected\"";} ?>>Gold</option>
<option value="White" <?php if (!(strcmp("White", (ValidatedField("index_500","tee1"))))) {echo "selected=\"selected\"";} ?>>White</option>
<option value="Blue" <?php if (!(strcmp("Blue", (ValidatedField("index_500","tee1"))))) {echo "selected=\"selected\"";} ?>>Blue</option>
<option value="Black" <?php if (!(strcmp("Black", (ValidatedField("index_500","tee1"))))) {echo "selected=\"selected\"";} ?>>Black</option>
</select>
<?php
if (ValidatedField('index_500','index_500')) {
if ((strpos((",".ValidatedField("index_500","index_500").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
<span class="stylered">Tee Required</span>
<?php //WAFV_Conditional index.php index_500(2:)
}
}
}?>
<br />
<br />
<label for="pairing1"><strong>Pairing Request:</strong></label>
<textarea name="pairing1" id="pairing1" cols="45" rows="5"><?php echo(ValidatedField("index_500","pairing1")) ?></textarea>
<br />
<br />
<input type="submit" name="submit2" id="submit2" value="Submit Saturday Signup" />
</p>
</form>

It seems that the if in array statement would have to include both First Name and Last Name, but not sure?

Currently the validation to require a choice for player1 works but does not bind the choice upon validation failed.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...