PHP - How Process Form In The Same Page
Hey guys my code is like this
Code: [Select] <?php if( $_POST["name"] || $_POST["age"] ) { echo "Welcome ". $_POST['name']. "<br />"; echo "You are ". $_POST['age']. " years old."; exit(); } ?> <html> <body> <form action="<?php $_PHP_SELF ?>" method="POST"> Name: <input type="text" name="name" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> </body> </html> The Inputs are taken from form.How do I make it display somewhere at the bottom of the form in the same page.The Output of this code comes up in a new page. Similar TutorialsThe error is "Error: Duplicate entry '' for key 'usr'" I don't have any fields with that name. here is the process code. <?php $con = mysql_connect("localhost","uname","pw") or die('Could not connect: ' . mysql_error()); mysql_select_db("db") or die(mysql_error()); $FirstName=mysql_real_escape_string($_POST['FirstName']); //This value has to be the same as in the HTML form file $LastName=mysql_real_escape_string($_POST['LastName']); //This value has to be the same as in the HTML form file $UserName=mysql_real_escape_string($_POST['UserName']); //This value has to be the same as in the HTML form file $Password= md5($_POST['Password']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['email']); //This value has to be the same as in the HTML form file $Zip=mysql_real_escape_string($_POST['Zip']); //This value has to be the same as in the HTML form file $Birthday=mysql_real_escape_string($_POST['Birthday']); //This value has to be the same as in the HTML form file $Security=mysql_real_escape_string($_POST['Security']); //This value has to be the same as in the HTML form file /* * Specify the field names that are in the form. This is meant * for security so that someone can't send whatever they want * to the form. */ $allowedFields = array( 'FirstName', 'LastName', 'UserName', 'Password', 'email', 'Birthday', 'Zip', 'Security', ); // Specify the field names that you want to require... $requiredFields = array( 'FirstName', 'LastName', 'UserName', 'Password', 'email', 'Birthday', 'Zip', 'Security', ); $errors = array(); foreach($_POST AS $key => $value) { // first need to make sure this is an allowed field if(in_array($key, $allowedFields)) { $$key = $value; // is this a required field? if(in_array($key, $requiredFields) && $value == '') { $errors[] = "The field $key is required."; } } } // were there any errors? if(count($errors) > 0) { $errorString = '<p>There was an error processing the form.</p>'; $errorString .= '<ul>'; foreach($errors as $error) { $errorString .= "<li>$error</li>"; } $errorString .= '</ul>'; // display the previous form include 'index.php'; } else { $sql="INSERT INTO Profile (`FirstName`,`LastName`,`Username`,`Password`,`email`,`Zip`,`Birthday`,`Security`) VALUES ('$FirstName','$LastName','$UserName','$Password','$email','$Zip','$Birthday','$Security')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } //send email mail('email@gmail.com','A profile has been submitted!',$FirstName.' has submitted their profile',$body); // display the thank you page header("Location: thanks.html"); } With the following code
<?php ?> There is still an error output of syntax error on line 11, please help, what's wrong with my code I have this form I am trying to process, but it won't work? if($count==0){ Code: [Select] echo "That Bidder Number is NOT logged in, "; echo "would you like to set this bidder as active?"; echo " Enter 1 for NO or 2 for YES"; echo "<form action= \"process.php\" method= \"POST\">"; echo "<input type =\"text\" name= \"logUser\"/>"; echo "<input type= \"submit\" value = \"Submit\"/>"; $logUser= isset($_POST['logUser']) ? $_POST['logUser'] : ''; header("Location: process.php"); exit(); } All I want to do is process the users input and either input data into the database or simply redirect the user. Why the hell is this so complicated for?? I am processing the form on the same page it is displayed. Here's my procressing Code: [Select] if ($logUser= 1) { header("Location: inprogress.php"); exit(); } else if ($logUser= 2){ // Add $biddersId and redirect to anypage mysql_connect("$host", "$db_user", "$db_password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select DB"); mysql_Query("INSERT INTO bidders (biddersId) VALUES ('$winningBidder')"); mysql_query("INSERT INTO transactions (itemDescription, itemPrice, bidderId, itemQty , totalPrice) VALUES('$itemDescription', '$itemPrice','$winningBidder', '$itemQty', '$totalPrice')") or die(mysql_error()); header("Location: inprogress.php"); exit(); } I need some assistance with an error I get when trying to submit a form to my email address. the error is this: Warning: mail() [function.mail]: SMTP server response: 555 syntax error (#5.5.4) in E:\Contact\process.php on line 74 Sorry, unexpected error. Please try again later the form code is Code: [Select] <form id="form" action="process.php" method="post" name="ContactForm"> <label for="Name">Name</label> <input type="text" name="name" id="name" /> <label for="email">E-mail</label> <input type="text" name="email" id="email" /> <label for="website">Website</label> <input type="text" name="website" id="website" /> <label for="message">Message</label> <textarea class="resizable" name="comment"> </textarea> <input type="submit" name="submit" id="submit" value="Submit"> </form> and the process code [php] <?php //Retrieve form data. //GET - user submitted data using AJAX //POST - in case user does not support javascript, we'll use POST instead $name = ($_GET['name']) ? $_GET['name'] : $_POST['name']; $email = ($_GET['email']) ?$_GET['email'] : $_POST['email']; $website = ($_GET['website']) ?$_GET['website'] : $_POST['website']; $comment = ($_GET['comment']) ?$_GET['comment'] : $_POST['comment']; //flag to indicate which method it uses. If POST set it to 1 if ($_POST) $post=1; //Simple server side validation for POST data, of course, you should validate the email if (!$name) $errors[count($errors)] = 'Please enter your name.'; if (!$email) $errors[count($errors)] = 'Please enter your email.'; if (!$comment) $errors[count($errors)] = 'Please enter your comment.'; //if the errors array is empty, send the mail if (!$errors) { //recipient $to = 'My Name <email@gmail.com>'; //sender $from = $name . ' <' . $email . '>'; //subject and the html message $subject = 'Comment from ' . $name; $message = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head></head> <body> <table> <tr><td>Name</td><td>' . $name . '</td></tr> <tr><td>Email</td><td>' . $email . '</td></tr> <tr><td>Website</td><td>' . $website . '</td></tr> <tr><td>Comment</td><td>' . nl2br($comment) . '</td></tr> </table> </body> </html>'; //send the mail $result = sendmail($to, $subject, $message, $from); //if POST was used, display the message straight away if ($_POST) { if ($result) echo 'Thank you! I have received your message.'; else echo 'Sorry, unexpected error. Please try again later'; //else if GET was used, return the boolean value so that //ajax script can react accordingly //1 means success, 0 means failed } else { echo $result; } //if the errors array has values } else { //display the errors message for ($i=0; $i<count($errors); $i++) echo $errors[$i] . '<br/>'; echo '<a href="form.php">Back</a>'; exit; } //Simple mail function with HTML header function sendmail($to, $subject, $message, $from) { $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: ' . $from . "\r\n"; $result = mail($to,$subject,$message,$headers); if ($result) return 1; else return 0; } ?> [/php] This is a strange one, as I have many forms on my various sites, and on this site, the file in question is used by several functions. Ultimately, I'm wanting it INSERT values from the form, which I'll eventually add more of. Form is process and is stent to rn_process.php, which is the code listed below. include(ABSPATH ."resources/con.php"); $grade = $_POST['grade']; $position = $_POST['position']; echo $grade.$position; $query = "INSERT INTO a_rankings_select (username,userID,grade,position) VALUES ('" .$username. "', '" .$userID. "', '" .$grade. "', '" .$position. "')";
It echoes the correct $grade and $position when I comment out the INCLUDE. So I know it's passing the correct values. However, when the INCLUDE is active, I get the following error: Quote
Warning: include(ABSPATHresources/con.php): failed to open stream: No such file or directory in /home2/csi/public_html/resources/rankings_navigation_process.php on line 2 resources/con.php is a file I link to many times, and it's work in those instances. It's certainly not executing the INSERT. Edited March 26, 2020 by Jim RCan someone please help? I am simply trying to email process a form with checkboxes and then redirect to a thank you page. It works fine as long as at least one checkbox is checked. It breaks if no checkboxes are checked using the implode function to list the "interests". I'm getting this error (and no redirect to my thank you page): Warning: implode() [function.implode]: Invalid arguments passed... <?php if (isset($_REQUEST['submit'])) { $email = $_REQUEST['email']; $firstName = $_REQUEST['firstName']; $lastName = $_REQUEST['lastName']; $address = $_REQUEST['address']; $city = $_REQUEST['city']; $state = $_REQUEST['state']; $zipcode = $_REQUEST['zipcode']; $homePhone = $_REQUEST['homePhone']; $cellPhone = $_REQUEST['cellPhone']; $interest = $_REQUEST['interest']; $imploded_interest = implode(',',$interest); $comments = $_REQUEST['comments']; $to = 'myemailhere@yahoo.com'; $subject = 'Volunteer Signup'; $message = " <html> <head> <title>Volunteer Signup</title> </head> <body> <p>Hello,<br/>A visitor has submitted the following information from the volunteer page:</p> <p><b>$firstName $lastName</b><br/> $address<br/> $city, $state $zipcode<br/><br/> Home Phone: $homePhone<br/> Cell Phone: $cellPhone<br/> Email: <strong>$email</strong><br/><br/> I would like to help in the following ways:<br/> $imploded_interest </p><br/> <p>$firstName would also like share the following comments:<br/> <q><i>$comments</i></q> </p> </body> </html> "; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Volunteer Signup <myemailhere@yahoo.com>' . "\r\n"; mail($to, $subject, $message, $headers); } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Volunteer</title> </head> <body> <form id="VolunteerForm" method="post" action="thankyou.php"> <table> <tr> <td style="width:150px;">Email Address:</td> <td><input name="email" type="text" id="email" /></td> <td style="width:320px;" class="padtr"><strong>Ways I can help:</strong></td> </tr> <tr> <td>First Name:</td> <td><input name="firstName" type="text" id="firstName" /></td> <td class="padtr"><input name="interest[]" value="yard-sign" type="checkbox"/> Put a yard sign in my yard</td> </tr> <tr> <td>Last Name:</td> <td><input name="lastName" type="text" id="lastName" /></td> <td class="padtr"><input name="interest[]" value="fundraiser-at-home" type="checkbox" /> Host a fundraiser at my home</td> </tr> <tr> <td>Address:</td> <td><input name="address" type="text" id="address" /></td> <td class="padtr"><input name="interest[]" value="phone-calls" type="checkbox" /> Make phone calls to friends and family</td> </tr> <tr> <td>City:</td> <td><input name="city" type="text" id="city" /></td> <td class="padtr"><input name="interest[]" value="mailings" type="checkbox" /> Help with mailings</td> </tr> <tr> <td>State:</td> <td><input name="state" type="text" id="state" /></td> <td class="padtr"><input name="interest[]" value="doors-literature" type="checkbox" /> Help knock on doors and distribute literature</td> </tr> <tr> <td>Zip Code:</td> <td><input name="zipcode" type="text" id="zipcode" /></td> <td class="padtr"><input name="interest[]" value="donate" type="checkbox" /> Make a donation</td> </tr> <tr> <td>Home Phone:</td> <td><input name="homePhone" type="text" id="homephone" /></td> <td class="padtr"><input name="interest[]" value="endorsement" type="checkbox" /> Use my name as an endorsement</td> </tr> <tr> <td>Cell Phone:</td> <td><input name="cellPhone" type="text" id="cellphone" /></td> <td class="padtr"><input name="interest[]" value="newsletter" type="checkbox" /> Sign up for our newsletter</td> </tr> <tr> <td>Comments:</td> <td><textarea name="comments" id="comments" rows="5" cols="17"></textarea></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> <input type="submit" name="submit" id="submit" value="Submit Now" /> <input type="reset" name="reset" id="reset" value="Clear Form" /></td> </tr> </table> </form> </body> </html> I am not getting the result I am hoping for. The code below is full code after a form has been submitted containing a member name and amount of credits: Code: [Select] <?php if (isset($t)){ $t = $_GET['t'];} ?> <?php $amount = $_POST['amount']; $member = $_POST['member']; $sql = ("SELECT vtp_members.name, vtp_members.team_id FROM vtp_members WHERE vtp_members.team_id=".$_GET['t']." AND vtp_members.name='$member' AND teams.team_treasure >= '$amount' "); $result = mysql_query($sql); $numrows = mysql_num_rows($result); if($numrows == '1') { $sql2 = "UPDATE vtp_members, teams SET vtp_members.hits=(vtp_members.hits + '$amount'), teams.team_treasure=(teams.team_treasure - '$amount') WHERE vtp_members.name='$member' AND teams.team_id=".$_GET['t']." "; $results2 = mysql_query($sql2); $row2 = mysql_fetch_row($results2); $tmap2 = $row2[0]; echo "You sent ". $amount . "credits to " . $member . ". "; } else { echo "The treasure holdings are too low for this transfer<br>(or an error occured)";} ?> Problem; it returns the else statement although the "teams.team_treasure" is higher or equal to "$amount" Hi all, I have my whole script working only the name of the upload file won't pass to the process.php page. Any help much appreciated. Prob just some silly mistake that i made but i can't for the life of me see it. form Code: [Select] <form enctype="multipart/form-data" action="process.php" method="POST" name="books" title="Santa_Book"> <img src="images/book/Enter_your_details.png" width="400" height="60" /><br /> <ul id="inline_list"> <input type="text" name="first_name" id="first_name" value="Text to be displayed here" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/> <label for="sur_name" class="inside">Name</label> <input name="sur_name" type="text" id="sur_name" class="inside" /> <label for="sname">Surname</label> <br /> Sex <select name="sex" id="sex"> <option selected="selected">Please Select....</option> <option value="girl">Girl</option> <option value="boy">Boy</option> </select> <label for="age">Age</label> <input type="text" name="age" id="age" /> <br /> <label for="house_no">House No.</label> <input type="text" name="house_no" id="house_no" /> <br /> <label for="street">Street Name</label> <input type="text" name="street" id="street" /> <br /> <label for="town">Town</label> <input type="text" name="town" id="town" /> <br /> <br /> <select name="bscf1" id="bscf1"> <option selected="selected">Please Select...</option> <option value="Brother1">Brother</option> <option value="Sister1">Sister</option> <option value="Cousin1">Cousin</option> <option value="Friend1">Friend</option> </select> <label for="bscf_name1">Friend / Sibling</label> <input type="text" name="bscf_name1" id="bscf_name1" /> <br /> <select name="bscf2" id="bscf2"> <option>Please Select...</option> <option value="Brother2">Brother</option> <option value="Sister2">Sister</option> <option value="Cousin2">Cousin</option> <option value="Friend2">Friend</option> </select> <label for="bscf_name2">Friend / Sibling</label> <input type="text" name="bscf_name2" id="bscf_name2" /> <br /> <label for="from_name">This book is from...</label> <input type="text" name="from_name" id="from_name" /> <br /> <input name="uploadedfile" type="file" id="uploadedfile" value="Upload Image" /> <br /> </ul> <br /> <input type="submit" value="Continue" /> </form> process.php page Code: [Select] <?php // Database connect $con = mysql_connect("mysql1.myhost.ie","admin_book","root123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("book_test", $con); //Parse Values from Coupon.php Form $first_name = mysql_real_escape_string(trim($_POST['first_name'])); $sur_name = mysql_real_escape_string(trim($_POST['sur_name'])); $sex = mysql_real_escape_string(trim($_POST['sex'])); $age = mysql_real_escape_string(trim($_POST['age'])); $house_no = mysql_real_escape_string(trim($_POST['house_no'])); $street = mysql_real_escape_string(trim($_POST['street'])); $town = mysql_real_escape_string(trim($_POST['town'])); $bscf1 = mysql_real_escape_string(trim($_POST['bscf1'])); $bscf_name1 = mysql_real_escape_string(trim($_POST['bscf_name1'])); $bscf2 = mysql_real_escape_string(trim($_POST['bscf2'])); $bscf_name2 = mysql_real_escape_string(trim($_POST['bscf_name2'])); $from_name = mysql_real_escape_string(trim($_POST['from_name'])); $uploadedfile = mysql_real_escape_string(trim($_POST['name'])); if ($sex == 'girl') { $his_her = 'her'; } else { $his_her = 'his'; } if ($sex == 'girl') { $him_her = 'her'; } else { $him_her = 'his'; } $sql="INSERT INTO details (first_name, sur_name, sex, age, house_no, street, town, bscf1, bscf_name1, andy, bscf2, bscf_name2, his_her, him_her, from_name, uploadedfile) VALUES ('$first_name','$sur_name','$sex','$age','$house_no','$street','$town','$bscf1','$bscf_name1','and','$bscf2','$bscf_name2','$his_her','$him_her','$from_name','$uploadedfile')"; // Where the file is going to be placed $target_path = "uploads/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } echo 'Thank you '. $first_name . ' for entering your details bro.<br />'; echo 'surname is : '. $sur_name . '.<br />'; echo 'sex is : '. $sex . '.<br />'; echo 'age is: '. $age . ' .<br />'; echo 'bscf friend 1 is : '. $bscf1 . '.<br />'; echo 'bscf name 1 is : '. $bscf_name1 . '.<br />'; echo 'bscf friend 2 is : '. $bscf2 . '.<br />'; echo 'bscf name 2 is : '. $bscf_name2 . '.<br />'; echo 'his_her is : '. $his_her . ' .<br />'; echo 'him_her is : '. $him_her . '.<br />'; echo 'From Name is : '. $from_name . '.<br />'; echo 'Uploaded file is : '. $uploadedfile . '.<br />'; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } ?> my front page of d site is having som links like login ,register...whenever i click on login it shows me login.php properly in another div ..but whenever i submit username and pasword n click on submit button d loginprocess.php starts downloading on google chrome...i dnt understand why Hello! I am executing an external command from a PHP script, using the exec function. Since this program can take more than 1-2 minutes to run, I thought I should use a "Loading page...please wait". What I need is to be able to get the process id from the external program that is being run and, when this finishes, I'll start outputting the results. Is there a way to do this? i have a form for which the data is sent to a process page via jquery like so: Code: [Select] jQuery.post('<?php echo $this->site_root; ?>/modules/new_post_process.php',{ message:jQuery("#message_contents").val() } ,function(data) {etc... new_post_process checks the contents of message like so: if (empty($message) && empty($error)) { $is_error = true; $error = 'Please Enter A Message'; } the problem is that it always throws this message even when the textarea isnt empty. however after the error has appeared if i submit again it goes through fine. I suppressed the error and tried and the database gets populated with an empty value which means it is indeed empty. so why does it work on the second time around? I am using CKEditor for the textarea. everything else gets submitted normally but this textarea. heres the full code: the textarea: Code: [Select] <textarea cols="80" rows="10" id="message_contents"></textarea> Code: [Select] jQuery("#new_post_form").submit(function() { jQuery.post('<?php echo $this->site_root; ?>/modules/new_post_process.php',{ user_name:jQuery("#user_name").val(), redirect_url:jQuery("#redirect_url").val(), subject:jQuery("#subject_field").val(), forum_id:jQuery("#fid").val(), topic_id:jQuery("#tid").val(), method:jQuery("#method").val(), message:jQuery("#message_contents").val() } ,function(data) { if (data == 1) { jQuery("#process_info").removeClass().addClass("subject_okay").html("<img src=\"<?php echo $this->template_path; ?>icons/small_tick.png\" alt=\"icon\" />Redirecting...").fadeIn("slow"); var URL = jQuery("#redirect_url").val(); document.location = URL; } else { jQuery("#reply_btn").css("visibility", "visible"); jQuery("#draft_btn").css("visibility", "visible"); jQuery("#process_info").removeClass().addClass("subject_error").html('<img src="<?php echo $this->template_path; ?>icons/small_error.png" alt="icon" /> ' + data).fadeIn("slow"); } }); and the process page: if (isset($_POST['subject'])) { $message = $_POST['message']; if (empty($message) && empty($error)) { $is_error = true; $error = 'Please Enter A Message'; } if (empty($error) && $is_error == false) { $query = $link->prepare("INSERT INTO ".TBL_PREFIX."posts (p_fid, p_tid, p_poster, p_name, p_content, p_time_posted) VALUES ('$forum_id', '$topic_id', '$user_name', '$subject', '$message', '".$config['time_now']."') ") or die(print_link_error()); echo "1"; } else { echo $error.'-'.$message; } Hey guys, I've hit a huge obstacle in my coding process of a script I am writing. It is basically an uploading interface script and it works like this. I have files on my server and I want a user to click a button which fires a php script which in turn fires a bash script which IN TURN fires the uploading program (plowshare). So to make it simple: user logs in, sees upload button. Clicks it, file starts uploading. I then want the user to see "upload initiated" and that's it. The problem is that with what I have now, the script just won't finish loading until the file has been uploaded and as a matter of fact I don't even think it is uploading anything :S Here are the scripts: PHP interface to call the bash script: Code: [Select] <?php error_reporting(E_ALL); function run_in_background($Command, $Priority = 0) { if ($Priority) $PID = shell_exec("nohup nice -n $Priority $Command 2> /dev/null & echo $!"); else $PID = shell_exec("nohup $Command 2> /dev/null & echo $!"); return($PID); } function is_process_running($PID) { exec("ps $PID", $ProcessState); return(count($ProcessState) >= 2); } $file = $_GET['file']; // Location of file relative to the index $where = $_GET['where']; // Absolute index location $absolute = '/var/www/vhosts/animekyun.com/httpdocs/icarus/'; $where = $absolute . $where; //$outfile ='log'; echo $where . $file . '<br>'; echo "<h2>The upload has been initiated!</h2>"; $ps = run_in_background("/bin/sh uploadparser.sh $file $where > $outfile"); while(is_process_running($ps)) //echo $output; ?> Bash script to call uploading program: Code: [Select] #!/bin/sh { FILE=$1 WHERE=$2 FILENAME="/var/www/vhosts/animekyun.com/httpdocs/icarus/debug/debug_mu_$FILE" FILENAME2="/var/www/vhosts/animekyun.com/httpdocs/icarus/debug/debug_multi_$FILE" /usr/local/bin/plowup megaupload "$WHERE$FILE" >> "$FILENAME".txt 2>&1 /usr/local/bin/plowup multiupload "$WHERE$FILE" >> "$FILENAME2".txt 2>&1 } & this works fine when I pass the variables as arguments in CLI I hope i have been clear enough, it does seem rather confusing I have a full working order form in PHP. I process it and display it with a process page called "process.php." Whenever this information is displayed on the web page "process.php" I also want it to send me an e-mail with all of the information that it just processed. i.e. Checked checkboxes, text entered, etc. Whenever I try to send the contents of "process.php" to an email $message = include 'process.php'; the process page just goes through an infinite loop displaying itself over and over again instead of sending itself in an email.
Edited by AP_King7, 20 August 2014 - 10:51 AM. I have this code: $shell = new COM('WScript.Shell'); $shell->Run("C:\WINDOWS\system32\cmd.exe /K ".$ini['indexer']['command'], 0, false); When it runs, it opens the command line, but then when it is done, it leaves the process open. How can I close it when the process is complete? Hi guys, I want my application to run a triggered process based on time to execute some tasks, what is the best approach? Thanks hi, is there a way to tell php to do a process again? example: Code: [Select] $draft_number=rand(1, 15); if($draft_number == 5){ START OVER AT TOP } else { $sql1 = "UPDATE names SET draft = '$draft_number' WHERE id = '$uid'"; $result1 = mysql_query($sql1) or die('Error, Check you fields and try again.'); } This may spill over into java, just not quite sure yet! Basically what I am trying to do, is fill a box with text, click a button which runs a function which send the text in the box via a JSON request to an external server. The JSON works fine, I just want a way of submitting the string which hopefully doesnt involve a form, but its the only way I can think of! Any other ideas? I have been trying to figure out how this is done? One php file and all that changes is the name of the brand and the logo. This has to be clickable from a menu and also if a user changes the brand name it changes to the appropriate name and logo. Any ideas as to how this is done? If you can guide me in the right direction or give me an example of how this is done would be greatly appreciated. Thanks. http://www.drivermanager.com/en/download-confirmation.php?brand=compaq&logo= I have this 3 tables
users (id_user)
music_styles (id_style, style) ex. (1) - (Blues)
user_styles (id_user, id_style)
I'm trying to create a form in which the user ($user = $_SESSION['id_user']) chooses through a multiple select the styles of preference to store them in the database using mysqli statements.
If the styles prefered are selected they should be displayed in the select input later, how can i accomplish this?
Thanks.
|