Search Results

Search found 5 results on 1 pages for 'bccarlso'.

Page 1/1 | 1 

  • How can I accept a hash mark in a URL via $_GET?

    - by bccarlso
    From what I have been able to understand, hash marks (#) aren't sent to the server, so it doesn't seem likely that I will be able to use raw PHP to parse data like in the URL below: index.php?name=Ben&address=101 S 10th St Suite #301 I'm looking to pre-populate form fields with this $_GET data. How would I do this with Javascript (or jQuery), and is there a fallback that wouldn't break my form for people not using Javascript? Currently if there is a hash (usually in the address field), everything after that is not parsed in or stored in $_GET.

    Read the article

  • Matching array elements to get an array element at another index

    - by bccarlso
    I have a PHP array that I'm using to generate an HTML form. The PHP array is this: <?php $vdb = array ( array( "Alabama", 275), array( "Alaska", 197), array( "Arizona", 3322)); ?> The PHP to generate the HTML form is below. I need to have the value be the name of the state, because there is some AJAX I'm using to display which states a user has chosen. <?php echo "<table border='1'><thead><tr><th></th><th>State</th><th>Contacts</th><th>Email</th></tr></thead>"; for ($row = 0; $row < 42; $row++) { echo "<tr><td class='input_button'><input type='checkbox' name='vdb[]' value='".$vdb[$row][0]."' title='".$vdb[$row][1]."' /></td>"; echo "<td>".$vdb[$row][0]."</td>"; echo "<td>".$vdb[$row][1]."</td>"; } echo "</table>"; ?> What I'm trying to do is, on submission of the form, with the states the user selected, loop through the PHP array and total the numbers from the selected states. So if I checked Alabama and Alaska, I'd want to add 275 + 197. This is what I thought would have worked, but it's not: <?php $vendors = array(); if (isset($_POST["vdb"])) { $vendors = $_POST["vdb"]; } $ven_i = 0; $ven_j = 0; $ven_total = 0; foreach ($vendors as $value) { foreach ($vdb as $vdb_value) { if ($vendors[$ven_i] == $vdb[$ven_j][0]) { $ven_total += $vdb[$ven_j][1]; } $ven_j++; } $ven_i++; } ?> and then $ven_total should be the total I'm looking for. However, $ven_total just ends up being the first checkbox selected, and it ignores the rest. I am doing this correctly with the AJAX, displaying the total on the front end, but I don't know how to pass that on to the form submission. I'd rather not using GET and URL variables, because a user could type something into the URL and modify the count. Any idea what I'm doing wrong, or a better way to approach this that I would be able to understand? (Very much a novice programmer.)

    Read the article

  • When writing a form submit to a file, strip line breaks and commas

    - by bccarlso
    I have a form with a textarea in it. I log the results to a text file on the server, but I would like to strip out any line breaks a user would put in the textarea, as well as any commas that would interfere with importing the comma-delimited log text file into Excel or something for later use. I think this has to do with regex, but I'm no expert and could use some help. Or maybe there is an easy PHP function that will do it?

    Read the article

  • Dynamically load _gallery_ (not album) in SlideShowPro using SWFObject

    - by bccarlso
    Hi all. I have been successful in dynamically loading an album in SSP before, but using SSP Standalone. I did it like this: var flashvars = { xmlFilePath: "http://site.com/ssp_director/images.php?album=5" } What I'm looking to do now, though, is dynamically load a gallery when the page loads, using text entered in the javascript, or flashvars I'd assume. I'm using ActionScript 3 with this, so I'm not sure if I have to do something to the SSP instance in Flash. I'm not very good with AS3, so following advice or tutorials is about all I can muster. I'm also using SSP Director, so my gallery XML URLs would be similar to above in the example code. I'd be elated if this is possible, otherwise I will have to find an alternative solution. Thanks so much for help!

    Read the article

  • Allow alphanumeric, punctuation, and spaces

    - by bccarlso
    I'm pretty new to regular expressions, and MAN do they give me a headache. They are so intimidating! For an email campaign I'm doing, a user will click a link out of the email with a few URL parameters filled in for them, to make filling out a form easier. I want to prevent any injection hacks or whatever it's called, but need to allow the $_GET parameters to be alphanumeric, have punctuation, and have spaces. If someone has a good method for this, I'd appreciate it, but right now I have: foreach($_GET as $m=>$n) { $get[$m] = preg_replace('(^[a-z0-9 \-\_\.]+)i',' ',$n); } I would like to be able to replace all characters NOT found with this regular expression, which I believe I use ?!, but I can't get that to work either. Any help in getting this to work would be appreciated!

    Read the article

1