PHP - Moved: Passing Multiple Values To Javascript Function From Onclick() Action
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=359130.0 Similar Tutorials
Table Issue - Multiple Location Values For User Pushes Values Out Of Row Instead Of Wrapping In Cell
This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=348942.0 Ok, starting around line 137 with the functions..... Commented well. Just not sure If im doing it right. Any help greatly appreciated. Basic stuff and still learning. Just trying to figure out if Im passing by reference correctly or if not how to do it. Thanks. php File is attached but heres a snippet. Thanks in advance. Peace, Adam // The grand total and the item total need to be passed BY REFERENCE. function show_table_contents($cart_items, $table, &$grand_total, &$item_total) This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=313325.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=350049.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=309239.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=355358.0 Amazingly, PHP Coding Help is not the place to ask JavaScript questions. Mind blown. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=332796.0 I'm trying to send a submission to the following Craigslist form that uses javascript to trigger an auto submit. The user selects "For Sale" on my form and it will pass the data in a hidden div to the proper selection on the craigslist page. Heres the page it would be passing to. I know I will have to pass it in the URL. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <base href="https://post.craigslist.org"> <title>houston craigslist | choose type</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <link type="text/css" rel="stylesheet" media="all" href="/styles/craigslist.css?v=9"> </head> <body id="pp"> <table width="100%" id="header" summary="header"> <tr valign="top"> <td><a href="http://houston.craigslist.org/"><b>houston craigslist</b></a> > choose type<br></td> <td width="10%" class="highlight" style="text-align: right; white-space: nowrap;"> <font size="2" face="sans-serif" color="#7a7a7a">[ logged in as <a href="https://accounts.craigslist.org/login"><b>kennymahaffey@gmail.com</b></a> ] [ <a href="https://accounts.craigslist.org/logout">logout</a> ]</font> <br></td> </tr> </table> <hr> <blockquote> <div class="highlight"> <i>Please post to a single geographic area and category only -- cross-posting to multiple cities or categories is not allowed</i> </div> <h4>What type of posting is this:</h4> <form action="https://post.craigslist.org/k/kInfxI4M4RGIA7PWTF5SWg/HjdlJ" method="POST"> <blockquote> <label> <input type="radio" name="id" value="jo" onclick="form.submit(); return false;">job offered </label> <br> <label> <input type="radio" name="id" value="jw" onclick="form.submit(); return false;">resume / job wanted </label> <br> <br> <label> <input type="radio" name="id" value="ho" onclick="form.submit(); return false;">housing offered </label> <br> <label> <input type="radio" name="id" value="hw" onclick="form.submit(); return false;">housing wanted </label> <br> <br> <label> <input type="radio" name="id" value="fs" onclick="form.submit(); return false;">for sale </label> <i>(please do not post prohibited <sup><a target="_blank" href="http://www.craigslist.org/about/prohibited.items">[?]</a></sup> or recalled <sup><a target="_blank" href="http://www.craigslist.org/about/recalled_items">[?]</a></sup> items)</i> <br> <label> <input type="radio" name="id" value="iw" onclick="form.submit(); return false;">item wanted </label> <br> <br> <label> <input type="radio" name="id" value="go" onclick="form.submit(); return false;">gig offered </label> <i>(I'm hiring for a short-term, small or odd job)</i> <br> <label> <input type="radio" name="id" value="so" onclick="form.submit(); return false;">service offered </label> <br> <br> <label> <input type="radio" name="id" value="p" onclick="form.submit(); return false;">personal / romance </label> <br> <br> <label> <input type="radio" name="id" value="c" onclick="form.submit(); return false;">community </label> <br> <label> <input type="radio" name="id" value="e" onclick="form.submit(); return false;">event </label> <br> <br> </blockquote> <input type="hidden" name="U2FsdGVkX:18yNDg2NDI0O:A8dZroeLa8K5Y677RwK4hzBe2OPdD3XxLUDb5lS9LllELhxNpMqXZIwAWDxJ.7Wo4A" value="U2FsdGVkX18yNDg2NDI0OFjS1qgWn_NKgmgnh5qCZ9aK2m7eOmS-uAAM_Pwu8VHN"> <button type="submit" name="go" value="Continue">Continue</button> </form> </blockquote> This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=332103.0 I have a list of checkboxes, like e.g each checkbox has a value as ResumeID, now question is/are; 1) how to get the values of the checkboxes using jQuery ? 2) when I got the values of the checkboxes using jQuery, how to pass those values to a PHP Controller action ? This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=354981.0 Hi, I want to make a checkbox that will store the value as the user's database table ID and when the records are checked, I will have a delete, update link to delete/update those records that have their checkbox checked. I know I would need two submit buttons (one for delete and one for update), but the form tag only takes one action attribute, right? So does anyone know what I should do??? Le me know, thanks This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=316624.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=346692.0 Hi, My company has 240+ locations and as such some users (general managers) cover multiple sites. When I run a query to pull user information, when the user has multiple sites to his or her name, its adds the second / third sites to the next columns, rather than wrapping it inside the same table cell. It also works the opposite way, if a piece of data is missing in the database and is blank, its pull the following columns in. Both cases mess up the table and formatting. I'm extremely new to any kind of programming and maybe this isn't the forum for this question but figured I'd give it a chance since I'm stuck. The HTML/PHP code is below: <table id="datatables-column-search-select-inputs" class="table table-striped" style="width:100%"> <thead> <tr> <th>ID</th> <th>FirstName</th> <th>LastName</th> <th>Username</th> <th>Phone #</th> <th>Location</th> <th>Title</th> <th>Role</th> <th>Actions</th> </tr> </thead> <tbody> <?php //QUERY TO SELECT ALL USERS FROM DATABASE $query = "SELECT * FROM users"; $select_users = mysqli_query($connection,$query);
// SET VARIABLE TO ARRAY FROM QUERY while($row = mysqli_fetch_assoc($select_users)) { $user_id = $row['user_id']; $user_firstname = $row['user_firstname']; $user_lastname = $row['user_lastname']; $username = $row['username']; $user_phone = $row['user_phone']; $user_image = $row['user_image']; $user_title_id = $row['user_title_id']; $user_role_id = $row['user_role_id'];
// POPULATES DATA INTO THE TABLE echo "<tr>"; echo "<td>{$user_id}</td>"; echo "<td>{$user_firstname}</td>"; echo "<td>{$user_lastname}</td>"; echo "<td>{$username}</td>"; echo "<td>{$user_phone}</td>";
//PULL SITE STATUS BASED ON SITE STATUS ID $query = "SELECT * FROM sites WHERE site_manager_id = {$user_id} "; $select_site = mysqli_query($connection, $query); while($row = mysqli_fetch_assoc($select_site)) { $site_name = $row['site_name']; echo "<td>{$site_name}</td>"; } echo "<td>{$user_title_id}</td>"; echo "<td>{$user_role_id}</td>"; echo "<td class='table-action'> <a href='#'><i class='align-middle' data-feather='edit-2'></i></a> <a href='#'><i class='align-middle' data-feather='trash'></i></a> </td>"; //echo "<td><a href='users.php?source=edit_user&p_id={$user_id}'>Edit</a></td>"; echo "</tr>"; } ?>
<tr> <td>ID</td> <td>FirstName</td> <td>LastName</td> <td>Username</td> <td>Phone #</td> <td>Location</td> <td>Title</td> <td>Role</td> <td class="table-action"> <a href="#"><i class="align-middle" data-feather="edit-2"></i></a> <a href="#"><i class="align-middle" data-feather="trash"></i></a> </td> </tr> </tbody> <tfoot> <tr> <th>ID</th> <th>FirstName</th> <th>LastName</th> <th>Username</th> <th>Phone #</th> <th>Location</th> <th>Title</th> <th>Role</th> </tr> </tfoot> </table>
How do you have an HTML form process a function for an action? I tried what I have below, but i just can't get it to work right. Any ideas? Thanks for your help. For example: Code: [Select] <?php function UserLookup(){ $searchfield = $_POST['searchfield']; $client = new SoapClient("http://www.domain.com/webservice.asmx?WSDL"); $result = $client->UserLookup(array('searchfield'=>$searchfield)); echo json_encode($result); } if (isset($_GET['submit'])) { UserLookup(); } else { ?> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" > <input name="searchfield" type="text" size="45" /> <input type="submit" value=" Search " /> </form> <?php } ?> Hi, I'm creating a PHP application to handle my SQL server and I've run into a bit of a problem; I have two files atm: mainClass.php and testSite.php My mainClass.php looks like this: Code: [Select] class mainClass { private $host = 'localhost'; public function createDb($user,$pass,$dbName) { $con = mysql_connect($host, $user, $pass); if (!$con){ die('Could not connect: '.mysql_error()); } $sql = "CREATE DATABASE `$dbName`;"; if (!mysql_query($sql)){ die('Error 1: '.mysql_error()); } mysql_close(); } }and testSite.php looks like this: Code: [Select] <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> </head> <body> <h1>testSite for my PHP app</h1> <?php function __autoload($className){ require_once "./classes/{$className}.php"; } $test = new mainClass(); ?> <form name='createDb' method='post' action=''> User: <input type='text' name='user'><br> Password: <input type='password' name='pass'><br> dbName: <input type='text' name='dbName'><br> <input type='submit' value='Create DB'> </form> </body> </html> What I'm asking is if it is possible to make the form-action from testSite.php run the createDb function from mainClass.php I have pretty much no idea how to do it but I tried like this: Code: [Select] <form name='createDb' method='post' action="<?php $test->createDb($_POST['user'],$_POST['pass'],$_POST['dbName']); ?>"> User: <input type='text' name='user'><br> Password: <input type='password' name='pass'><br> dbName: <input type='text' name='dbName'><br> <input type='submit' value='Log in'> </form>But that just made the whole form disappear so now I'm completely lost, any help greatly appreciated. PS: I'm doing this to get better at PHP so please don't come with advice like "use a framework" or "there already are applications that handles this", I know there is. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=354366.0 hey guys i am stuck at one part. i am coding a site where on the index page there are 5 categories. Now on click of these it takes me to a page where i can search within a particular category. i can do it by statically giving <href="localhost/xampp/abc.php">and a fixed page path. but i want the name of the category passed when i click and the search page to open when i open search. thanks Hi guys
I would like to get whole content of html file after I submitted a password. The problem is that the my code doesn't access the value for the file. I tried to create a session but i doesn't work. What other option do I have to get the content of the html file?
session_start(); $selected_file = $_POST['radio1']; // get the filename of the file $fileinfo = pathinfo($selected_file); $filename = $fileinfo['dirname'] . DIRECTORY_SEPARATOR . $fileinfo['filename']; $password = 'code'; $lines = file("$filename.html"); $_SESSION['selectedfile'] = $selected_file; $_SESSION['file'] = $filename; $_SESSION['Scipt'] = ("$filename.html"); $_SESSION['Scipttext'] = $lines; $_SESSION['file2'] = $fileinfo; if (isset($_POST['submitradio'])) { echo '<div class="imageselected">'; echo '<img src="'.$_SESSION['selectedfile'].'" /></br>'.PHP_EOL; echo '</div>'; // check to see if a html file named the same also exists if(file_exists($_SESSION['Scipt'])) { echo "<form action='test_result.php' method='post'>"; echo '<div class="Password">'; echo 'Type in password to view full Script'; echo "<label><div class=\"Input\"><input type='password' name='passIT' value='passit'/></div>"; echo "<input type='submit' name='submitPasswordIT' value='Submit Password'/></div>"; echo '</div>'; echo "$filename.html shares the same name as $selected_file"; for($x = 1;$x<=15;$x++) { header( "Content-Type: file/html" ); $lines = ($_SESSION['Scipttext']); $new = strip_tags($lines); echo $lines[rand(0, count($lines)-1)]."<br>"; } // end of forloop } // end of check // start Sorrytext else { echo '<div class="NoScript">'; echo "Nothing available at the moment."; echo '</div>'; } // end Sorrytext } // End of submitradio if($_POST['submitPasswordIT']){ if ($_POST['passIT']== $password ){ echo "You entered correct password"; readfile($_SESSION['Scipt']); } else{ echo "You entered wrong password"; } } echo '</form>';I would be grateful for help. |